This recipe shows how one can collect DDL (Data Definition Language) from database logs in order to audit changes to the database structure.
postgresql.conf file, and set the following:
log_statement = 'ddl'
Setting it to 'mod' or 'all' is also ok for this. Don't forget to reload the configuration:
Now find all occurrences of
CREATE, ALTER, and
DROP commands in the log.
postgres@hvost:~$ egrep -i "create|alter|drop" \ /var/log/postgresql/postgresql-8.4-main.log
If log rotation is in effect, you may need to grep all logs also.
In case the log is too old, and you have not saved the older logs in some other place, you are out of luck.
The default settings in