Re: Adding ddl audit trigger

From: Kenneth Buckler <kenneth(dot)buckler(at)gmail(dot)com>
To: El Co <lc4od(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Adding ddl audit trigger
Date: 2011-01-28 14:49:53
Message-ID: AANLkTin=kJrOmy+6RpE9QvKCus_V9s4UUi-u7noAbWL4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You just need to log DDL, correct?

Why not just edit postgres.conf and set log_statement to 'ddl'.

See http://www.postgresql.org/docs/9.0/static/runtime-config-logging.html

If you need to include username, database, etc, take a look at
log_line_prefix on the same page.

Ken

On Wed, Jan 26, 2011 at 4:30 PM, El Co <lc4od(at)yahoo(dot)com> wrote:
> Trying to get some DDL auditing in a development environment by adding
> triggers to pg_proc, pg_class,pg_type,pg_trigger and getting the following
> error:
>
>
>
> ERROR: permission denied: "pg_proc" is a system catalog
>
> SQL state: 42501
>
>
>
> Is there any way to achieve DDL auditing in Postgres and trace any
> new/dropped/changed object into a table?
>
> All I need is to at least be able and save a userid(current_user),
> timestamp, action, and the name of the object and this could be done easily
> by adding triggers to these pg catalogs.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dmitriy Igrishin 2011-01-28 15:11:33 Re: Store base64 in database. Use bytea or text?
Previous Message Steve White 2011-01-28 13:55:51 Re: How best to load modules?