Re: Is there anyway for non-superuser to log all sql statements at the session level?

From: Dan Smith <j(dot)daniel(dot)smith1(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Is there anyway for non-superuser to log all sql statements at the session level?
Date: 2021-09-10 02:49:52
Message-ID: CAK50Jrx3azdVqVKVs+j3kqZQnfTU0pf9ve20J5H-E__pYSivJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

pgAudit would do the trick (https://www.pgaudit.org/). If memory serves,
you can specify a user to audit as well as the type of operations.

That said, if you are using migration scripts, it may be easier to just
keep the scripts in version control with a sequential naming convention.
Generally, these tools save state and know what has been applied.

Best regards,

Dan Smith

On Thu, Sep 9, 2021, 16:31 Hotmail <crajac66(at)hotmail(dot)com> wrote:

> Hi All,
>
> We use liquibase to run migrations against our postgres 11 database. We
> run the migrations as an application user that does not have superuser
> permissions. Is there any workaround we could use that would allow us to
> capture the migration sql that is run by our application user? We want to
> capture all of the ddl as well as the dml run by the migration user. Since
> setting log_statement=all at the session level isn’t possible unless the
> user is a superuser is there any other way to accomplish this task?
>
> Thanks,
>
>
> Craig Jackson
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Hotmail 2021-09-10 03:18:50 Re: Is there anyway for non-superuser to log all sql statements at the session level?
Previous Message Bossart, Nathan 2021-09-10 02:26:10 Re: Estimating HugePages Requirements?