plpgsql: can I use a variable in a DECLARE later whithin the DECLARE?
tomas@tuxteam.de
From: <tomas@tuxteam.de>
To: pgsql-hackers@postgresql.org
Date: 2021-10-29T12:14:35Z
Lists: pgsql-hackers
Hi,
In plpgsql, i'm trying to use a variable initialised in a DECLARE in
a later initialisation expression whithin the same DECLARE:
DECLARE
x int := 23;
y int := x + 4
BEGIN
...
Experiments suggest that it works, but the docs are silent about that.
Is this a good idea, or should I be more careful and do it in a nested
block?
(For Lispers: is that a let, or a let*? ;-)
Thanks & cheers
- tomás
Commits
-
Test and document the behavior of initialization cross-refs in plpgsql.
- a2a731d6c9db 15.0 landed