Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want a mechanism where I can store/track changes in stored procedure and triggers.

I want to track these logs in some table. What is the best possible way ?

share|improve this question
Do you want to track the changes to the source code of the stored procedures? Then use a version control system like Subversion or Git. And make sure you only deploy in a controlled way (or even consider a tool like Liquibase or Flyway) –  a_horse_with_no_name May 7 '14 at 6:27
You can't define triggers on system tables like pg_proc, so I'm afraid you'll have to do this outside PostgreSQL its self. –  Craig Ringer May 7 '14 at 6:55
Can I track for only stored procedures then for a database? I want something where an event/trigger occurs if a person changes / creates / drops a stored procedure. –  Abhishek May 7 '14 at 8:46
I am not sure but IIRC 9.4 will have trigger logging –  vedic May 8 '14 at 5:11
postgresql.org/docs/9.3/static/event-trigger-definition.html I guess you can build your solution on this, you can write from the procedure defined from the trigger. –  dezso May 8 '14 at 9:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.