pgsql: Test and document the behavior of initialization cross-refs in p

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Test and document the behavior of initialization cross-refs in p
Date: 2021-10-29 16:45:47
Message-ID: E1mgV0l-0000l4-Qf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Test and document the behavior of initialization cross-refs in plpgsql.

We had a test showing that a variable isn't referenceable in its
own initialization expression, nor in prior ones in the same block.
It *is* referenceable in later expressions in the same block, but
AFAICS there is no test case exercising that. Add one, and also
add some error cases.

Also, document that this is possible, since the docs failed to
cover the point.

Per question from tomás at tuxteam. I don't feel any need to
back-patch this, but we should ensure we don't break it in future.

Discussion: https://postgr.es/m/20211029121435.GA5414@tuxteam.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a2a731d6c9db0ba650aa6f7c4fe349ccf712f74d

Modified Files
--------------
doc/src/sgml/plpgsql.sgml | 12 ++++++++-
src/test/regress/expected/plpgsql.out | 48 +++++++++++++++++++++++++++--------
src/test/regress/sql/plpgsql.sql | 36 ++++++++++++++++++++------
3 files changed, 76 insertions(+), 20 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2021-10-29 17:57:07 pgsql: Demote pg_unreachable() in heapam to an assertion.
Previous Message Tom Lane 2021-10-29 15:39:46 pgsql: Update time zone data files to tzdata release 2021e.