Re: Can I use Postgres rules to reset session variables before/after queries? - Mailing list pgsql-general

From Tom Lane
Subject Re: Can I use Postgres rules to reset session variables before/after queries?
Date
Msg-id 1703888.1611553176@sss.pgh.pa.us
Whole thread Raw
In response to Re: Can I use Postgres rules to reset session variables before/after queries?  (Christophe Pettus <xof@thebuild.com>)
List pgsql-general
Christophe Pettus <xof@thebuild.com> writes:
>> On Jan 24, 2021, at 21:00, Andrew Stuart <andrew@salesgrid.com.au> wrote:
>> Can anyone suggest if session variables can be SET/RESET using Postgres rules, or optionally perhaps there is a
betterway to do so? 

> PostgreSQL poolers generally use the RESET ALL command when reassigning a session to clear the session state:
>     https://www.postgresql.org/docs/current/sql-reset.html

See also DISCARD, which clears even more session state:

https://www.postgresql.org/docs/current/sql-discard.html

I concur that trying to use rules for this is unlikely to work well.

            regards, tom lane



pgsql-general by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: Can I use Postgres rules to reset session variables before/after queries?
Next
From: Guillaume Lelarge
Date:
Subject: Re: CLUSTER, VACUUM, and TABLESPACEs (oh my)