how to add new column in pg_class for object creation date dumping

172 views Asked by At

I want to create a column in pg_class for object creation dumping but I am not able to add. I am using below query: ALTER TABLE pg_catalog.pg_class ADD COLUMN relcreated TIMESTAMP;

when I run this query I'm getting below error: ERROR: permission denied: "pg_class" is a system catalog SQL state: 42501 Please suggest any way for object creation time dumping. This is quite important for me for auditing purpose.

2

There are 2 answers

0
Richard Huxton On

That's a system table. You can't just fiddle with them.

You might find event triggers useful though.

2
Laurenz Albe On

Set log_statement = 'ddl' and get the information from the log file.

You cannot change a catalog like that “ that would require non-trivial changes to the PostgreSQL code, and you'd lose the information during every upgrade.