-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Tanveer Munavar edited this page May 10, 2020
·
9 revisions
- Create the database
create database demodb;
- Connect to the database
postgres=> \c demodb
- Load the SQL file
demodb=> \i ddl_logging.sql
Output :
CREATE TABLE
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE EVENT TRIGGER
CREATE EVENT TRIGGER
CREATE EVENT TRIGGER
- Create a table
CREATE TABLE t1(id int);
- DDL operation is captured in the log_ddl table
demodb=> select * from log_ddl;
-[ RECORD 1 ]---+------------------------------
id | 21
tag | CREATE TABLE
event | ddl_command_start
object_type | none
schema_name | none
object_name | none
object_identity | none
pid | 25930
txid | 2311810
client_addr | 172.16.64.65
username | mohamedt
time | 2020-05-10 21:49:59.548497+00
-[ RECORD 2 ]---+------------------------------
id | 22
tag | CREATE TABLE
event | ddl_command_end
object_type | table
schema_name | public
object_name | none
object_identity | public.t1
pid | 25930
txid | 2311810
client_addr | 172.16.64.65
username | mohamedt
time | 2020-05-10 21:49:59.548497+00