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

From: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
To: Hotmail <crajac66(at)hotmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, Dan Smith <j(dot)daniel(dot)smith1(at)gmail(dot)com>
Subject: Re: Is there anyway for non-superuser to log all sql statements at the session level?
Date: 2021-09-10 03:31:20
Message-ID: B2D5A861-5FF0-4CB0-90B9-A6422EB0D470@elevated-dev.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


> On Sep 9, 2021, at 9:18 PM, Hotmail <crajac66(at)hotmail(dot)com> wrote:
>
> Thanks for the suggestion. We currently use pgaudit at the database level for all ddL. Unfortunately, you must be a superuser to change pgaudit settings at the session level. Our desire is to capture the ddl/dml for a specific session. Capturing the dml at the database level with pgaudit would generate too much logging with our application user. Our migrations scripts are all checked into a git repo.
>
> We would like to get specific timestamp/timing info for each migration ddl/dml statement as it is executed. May not be possible in postgres for a non-superuser. We recently migrated off Oracle and we were able to do this as a non-superuser with session tracing but we are not aware similar capabilities in postgres.

Can't you use a single-purpose user to run migration scripts, and pgaudit to log everything that user does?

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message hubert depesz lubaczewski 2021-09-10 08:40:57 Re: Blank page
Previous Message Hotmail 2021-09-10 03:18:50 Re: Is there anyway for non-superuser to log all sql statements at the session level?