From: tomas@tuxteam.de
To: pgsql-hackers@postgresql.org
Subject: plpgsql: can I use a variable in a DECLARE later whithin the DECLARE?
Date: Fri, 29 Oct 2021 14:14:35 +0200
Message-ID: <20211029121435.GA5414@tuxteam.de> (raw)
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
Attachments:
signature.asc (application/pgp-signature, 197B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tomas@tuxteam.de
Subject: Re: plpgsql: can I use a variable in a DECLARE later whithin the DECLARE?
In-Reply-To: <20211029121435.GA5414@tuxteam.de>
References: <20211029121435.GA5414@tuxteam.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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