From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | depesz(at)depesz(dot)com |
Cc: | Hotmail <crajac66(at)hotmail(dot)com>, 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 10:36:21 |
Message-ID: | 3933156.1631270181@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
hubert depesz lubaczewski <depesz(at)depesz(dot)com> writes:
> On Thu, Sep 09, 2021 at 05:30:55PM -0600, Hotmail wrote:
>> 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?
> Sure. Make a security-definer function that changes the log_statement,
> and grant privileges to call it to whoever you need.
Also you can do
alter user foo set log_statement = 'all';
to apply the setting at future logins of user foo. (While a non-superuser
can't do that for themselves, a superuser can do it for them.)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Henry Francisco Garcia Cortez | 2021-09-10 16:10:40 | background writer |
Previous Message | hubert depesz lubaczewski | 2021-09-10 08:42:55 | Re: Is there anyway for non-superuser to log all sql statements at the session level? |