Re: Discarding DISCARD ALL

From: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
To: James Coleman <jtc331(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
Subject: Re: Discarding DISCARD ALL
Date: 2021-06-21 16:50:17
Message-ID: CANbhV-H2FKhpi143ObrMfk94JXqDzvgUZM=GPAy4RS4RGNqfbQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 20, 2021 at 3:53 PM James Coleman <jtc331(at)gmail(dot)com> wrote:
>
> On Wed, Jan 20, 2021 at 9:58 AM Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> >
> > On Wed, 20 Jan 2021 at 14:21, James Coleman <jtc331(at)gmail(dot)com> wrote:
> >
> > > An alternative approach that occurred to me while typing this reply: a
> > > setting in Postgres that would disallow setting session level GUCs
> > > (i.e., enforce `SET LOCAL` transaction level usage instead) would
> > > remove a large chunk of our need to set server_reset_query_always=1
> > > (and more interestingly it'd highlight when broken code gets pushed).
> > > But even with that, I see some value in the proposed setting since
> > > there is additional session state beyond GUCs.
> >
> > With transaction_cleanup=on we could force all SETs to be SET LOCAL.
> >
> > The point is that if we declare ahead of time that the transaction
> > will be reset then we can act differently and more easily for various
> > circumstances, for SETs, for Temp tables and others.
>
> Right, I agree it's independently useful. My "alternative" is a subset
> of that functionality and doesn't cover as many cases.

So if we go for that option, would we call it?

session_state = 'session' (default) | 'local_set'

If you use 'local' then you find that all state is transaction only
* SET defaults to meaning SET LOCAL
* SET SESSION returns ERROR

--
Simon Riggs http://www.EnterpriseDB.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-06-21 16:52:39 Re: disfavoring unparameterized nested loops
Previous Message Andrew Dunstan 2021-06-21 16:43:25 Re: Add version macro to libpq-fe.h