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

Поиск
Список
Период
Сортировка
От Melvin Davidson
Тема Re: Way to quickly detect if database tables/columns/etc. were modified?
Дата
Msg-id CANu8FiwwAut2rUatCNb_DFGC5fLXyi_FEL8+EOQiFgUwEo5n9w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Way to quickly detect if database tables/columns/etc. were modified?  (John DeSoi <desoi@pgedit.com>)
Ответы Re: Way to quickly detect if database tables/columns/etc. were modified?  (Evan Martin <postgresql2@realityexists.net>)
Список pgsql-general


On Mon, Oct 31, 2016 at 2:09 PM, John DeSoi <desoi@pgedit.com> wrote:

> On Oct 31, 2016, at 8:14 AM, Melvin Davidson <melvin6925@gmail.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.


I have tried using an event trigger to detect table creation (ie: tg_event_audit_all ) however, that does not parse the schema_name and objid
as does pg_event_trigger_dropped_objects(), so I am not sure that is a practical way to audit.

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

В списке pgsql-general по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: RPM Package of PostgreSQL 9.6.1 for CentOS
Следующее
От: Patrick B
Дата:
Сообщение: Re: Checking Postgres Streaming replication delay