pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: danydb@noalyss.eu
To: pgsql-docs@lists.postgresql.org
Subject: Re: SET feature
Date: Fri, 28 Oct 2022 13:59:08 +0200
Message-ID: <7fac2a589357d64cb249b057ddb91d7e747722c9.camel@cybertec.at> (raw)
In-Reply-To: <166695204625.630.3067402447013848509@wrigleys.postgresql.org>
References: <166695204625.630.3067402447013848509@wrigleys.postgresql.org>

On Fri, 2022-10-28 at 10:14 +0000, PG Doc comments form wrote:
> I remember in version 9 , to use variable you had to change in the
> postgresql. 
> 
> Today it is easier , just use
> 
> SET SESSION myprefix.myvariable =  'whatever' 
> 
> and all the transactions can use it , it is very useful in some cases, for
> example to track the author of a change , you don't need to change all your
> java/php/python code , just use a trigger on the table to fill up a column
> "change_by"
> 
> I've checked the documentation and that feature is not explained at all, not
> even in the SET Command.

Most people consider this a kind of abuse of what is known as "placeholder parameters",
documented in https://www.postgresql.org/docs/current/runtime-config-custom.html

See for example https://postgr.es/m/2982579.1662416866%40sss.pgh.pa.us

I believe it is a deliberate choice not to advertise that as "session variables",
particularly since there is an improvement in the pipeline:

https://commitfest.postgresql.org/40/1608/

Yours,
Laurenz Albe





view thread (2+ messages)

Message-ID: <7fac2a589357d64cb249b057ddb91d7e747722c9.camel@cybertec.at>
Permalink:  ../7fac2a589357d64cb249b057ddb91d7e747722c9.camel@cybertec.at/
Also on:    postgresql.org/message-id/7fac2a589357d64cb249b057ddb91d7e747722c9.camel@cybertec.at

 · 

reply

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-docs@postgresql.org
  Cc: laurenz.albe@cybertec.at, danydb@noalyss.eu, pgsql-docs@lists.postgresql.org
  Subject: Re: SET feature
  In-Reply-To: <7fac2a589357d64cb249b057ddb91d7e747722c9.camel@cybertec.at>

* 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