This article is half-done without your Comment! *** Please share your thoughts via Comment ***
How to log the DROP TABLE Statement in the log file of PostgreSQL?
Above is a common question/suggestion by the PostgreSQL DBA. We should log all the type of statements like DDL, DML. But DDL is most important than DML logging.
For logging the DDL statement into log files, we should change the following parameters in the postgresql.conf file.
log_statement=’ddl’
log_line_prefix = ‘%t %c %u ‘ (time, sessionid, user)
logging_collector = ON
For example:
I dropped a tbl_student table. Now, I can see below the line in my log file.
1 |
2017-12-08 16:23:12 CET LOG: statement: DROP TABLE tbl_student; |
Leave a Reply