From: hubert depesz lubaczewski <depesz@depesz.com>
To: Hotmail <crajac66@hotmail.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: Is there anyway for non-superuser to log all sql statements at the session level?
Date: Fri, 10 Sep 2021 10:42:55 +0200
Message-ID: <20210910084255.GB11352@depesz.com> (raw)
In-Reply-To: <SJ0PR06MB76469C5B646B4551B6292DBFD7D59@SJ0PR06MB7646.namprd06.prod.outlook.com>
References: <16e9ff79-fe32-4d0d-be57-7c823744a793@Spark>
<SJ0PR06MB76469C5B646B4551B6292DBFD7D59@SJ0PR06MB7646.namprd06.prod.outlook.com>
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.
Best regards,
depesz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: depesz@depesz.com, crajac66@hotmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: Is there anyway for non-superuser to log all sql statements at the session level?
In-Reply-To: <20210910084255.GB11352@depesz.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox