From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Wolfgang Walther <walther(at)technowledgy(dot)de> |
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:40:29 |
Message-ID: | CAFj8pRCBVSQS5tFeMQjeGZ=5G3TyKvbMKOEpmEMSNQfeOwbWOQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
pá 31. 5. 2024 v 15:29 odesílatel Wolfgang Walther <walther(at)technowledgy(dot)de>
napsal:
> 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.
>
but there is technical problem - plpgsql expression are internally SQL
queries. Isn't possible to cleanly to parse queries and expressions
differently.
>
> In this case you could still write:
>
> RAISE NOTICE '% %', x, (SELECT a,b FROM y);
>
> (assuming only x is a variable here)
>
> Best,
>
> Wolfgang
>
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2024-05-31 13:42:44 | Re: Schema variables - new implementation for Postgres 15 |
Previous Message | Wolfgang Walther | 2024-05-31 13:29:29 | Re: Schema variables - new implementation for Postgres 15 |