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 ?

  • 2
    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)
    – user1822
    May 7, 2014 at 6:27
  • 2
    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. May 7, 2014 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, 2014 at 8:46
  • I am not sure but IIRC 9.4 will have trigger logging
    – vedic
    May 8, 2014 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. May 8, 2014 at 9:01


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.