Re: SET feature

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: danydb(at)noalyss(dot)eu, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: SET feature
Date: 2022-10-28 11:59:08
Message-ID: 7fac2a589357d64cb249b057ddb91d7e747722c9.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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

In response to

  • SET feature at 2022-10-28 10:14:06 from PG Doc comments form

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2022-10-31 22:32:58 Partitioned tables are not processed by autovacuum.
Previous Message Daniel Gustafsson 2022-10-28 10:50:47 Re: First Person being used (only occurs in 2 other places in all of documentation)