tags:

views:

5

answers:

1

Hi Friends,

How can I know what are all the tables I have updated today in psql? Can anyone tell me.

Thanks in Advance.

+1  A: 

If you want to know such things, add a updatedBy (varchar login) and an updated (timestamp) column to every table.

Next, add a trigger to reach table which updates these two columns on INSERT and UPDATE.

Then you can run a query that gets you all tables plus a batch of queries which check in which tables something was updated by you.

If you want to see deletes, too, you will have to create another trigger which logs deletes but you need a different table for that or you must be able to mark all rows in all tables as "deleted" somehow without deleting them.

Aaron Digulla