DDL Triggers

From PostgreSQL wiki
Jump to navigationJump to search

DDL Triggers

This page is meant to coordinate work on DDL triggers.

Use cases

  • Enforce business logic
    • Example: Restrict table names to certain rules (CREATE TABLE trigger)
  • Auditing
    • Example: Need to know when somebody has dropped a table
  • Replication
    • Slony, Bucardo, etc. could replicate DDL statements automatically

Issues

  • Use of the existing hook
    • Need to support people who cannot use the hook (e.g. PgAdmin)
  • Current utility function is recursive: triggers should only fire on first call
  • What to export? Start simple with:
    • type of object
    • OID of object
    • name of object
    • action
  • Use nodeToString or nodeToSql?
  • Returning the original string?
  • Syntax of the call
  • How to store in a system table (map action to function)