Re: Way to quickly detect if database tables/columns/etc. were modified?

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: Evan Martin <postgresql2(at)realityexists(dot)net>, "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Way to quickly detect if database tables/columns/etc. were modified?
Date: 2016-10-31 18:09:51
Message-ID: F7797C11-F9E5-436A-82CE-230611DFC298@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> On Oct 31, 2016, at 8:14 AM, Melvin Davidson <melvin6925(at)gmail(dot)com> wrote:
>
> That would certainly work, but the problem is, that trigger would have to be created for every table in the database.
> When you have more than a couple dozen tables, as in hundreds, it becsmes a huge undertaking.

Unless I'm misunderstanding the documentation, you create the trigger on the "ddl event" not a table. The events are ddl_command_start, ddl_command_end, table_rewrite and sql_drop. I have not used this feature, but it seems like you would just need one function.

https://www.postgresql.org/docs/current/static/event-trigger-definition.html

John DeSoi, Ph.D.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igal @ Lucee.org 2016-10-31 18:52:08 RPM Package of PostgreSQL 9.6.1 for CentOS
Previous Message Adrian Klaver 2016-10-31 17:51:27 Re: Rows are repeating by the trigger function