Re: Schema variables - new implementation for Postgres 15

From: Wolfgang Walther <walther(at)technowledgy(dot)de>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, dean(dot)a(dot)rasheed(at)gmail(dot)com, er(at)xs4all(dot)nl, joel(at)compiler(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Schema variables - new implementation for Postgres 15
Date: 2024-05-31 13:29:29
Message-ID: 21674615-582e-42d0-b9a8-4dadbc8b7dad@technowledgy.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Pavel Stehule:
> The session variables can be used in queries, but should be used in
> PL/pgSQL expressions, and then the mandatory usage in FROM clause will
> do lot of problems and unreadable code like
>
> DO $$
> BEGIN
>   RAISE NOTICE '% %', (SELECT x FROM x), (SELECT a,b FROM y);
>
> END
> $$
>
> This requirement does variables unusable in PL

I already proposed earlier to only require listing them in FROM when
there is actually a related FROM.

In this case you could still write:

RAISE NOTICE '% %', x, (SELECT a,b FROM y);

(assuming only x is a variable here)

Best,

Wolfgang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2024-05-31 13:40:29 Re: Schema variables - new implementation for Postgres 15
Previous Message Pavel Stehule 2024-05-31 13:11:21 Re: Schema variables - new implementation for Postgres 15