pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedSET feature
2+ messages / 2 participants
[nested] [flat]
* SET feature
@ 2022-10-28 10:14 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Doc comments form @ 2022-10-28 10:14 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: danydb@noalyss.eu
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/15/sql-set.html
Description:
Hi,
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.
Hope it helps
Regards,
Sparkx
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: SET feature
@ 2022-10-28 11:59 Laurenz Albe <laurenz.albe@cybertec.at>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Laurenz Albe @ 2022-10-28 11:59 UTC (permalink / raw)
To: danydb@noalyss.eu; pgsql-docs@lists.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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-10-28 11:59 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 10:14 SET feature PG Doc comments form <noreply@postgresql.org>
2022-10-28 11:59 ` Laurenz Albe <laurenz.albe@cybertec.at>
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