pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Update docs & tests to reflect that unassigned OLD/NEW are now N
2+ messages / 1 participants
[nested] [flat]

* pgsql: Update docs & tests to reflect that unassigned OLD/NEW are now N
@ 2019-01-09 16:35 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-01-09 16:35 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Update docs & tests to reflect that unassigned OLD/NEW are now NULL.

For a long time, plpgsql has allowed trigger functions to parse
references to OLD and NEW even if the current trigger event type didn't
assign a value to one or the other variable; but actually executing such
a reference would fail.  The v11 changes to use "expanded records" for
DTYPE_REC variables changed the behavior so that the unassigned variable
now reads as a null composite value.  While this behavioral change was
more or less unintentional, it seems that leaving it like this is better
than adding code and complexity to be bug-compatible with the old way.
The change doesn't break any code that worked before, and it eliminates
a gotcha that often required extra code to work around.

Hence, update the docs to say that these variables are "null" not
"unassigned" when not relevant to the event type.  And add a regression
test covering the behavior, so that we'll notice if we ever break it
again.

Per report from Kristjan Tammekivi.

Discussion: https://postgr.es/m/CAABK7uL-uC9ZxKBXzo_68pKt7cECfNRv+c35CXZpjq6jCAzYYA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/59029b6fb71e187c150d12f4c37bb2bf982d3125

Modified Files
--------------
doc/src/sgml/plpgsql.sgml                       |  4 +--
doc/src/sgml/release-11.sgml                    | 18 ++++++++++++-
src/pl/plpgsql/src/Makefile                     |  2 +-
src/pl/plpgsql/src/expected/plpgsql_trigger.out | 36 +++++++++++++++++++++++++
src/pl/plpgsql/src/pl_exec.c                    | 11 ++++----
src/pl/plpgsql/src/sql/plpgsql_trigger.sql      | 24 +++++++++++++++++
6 files changed, 86 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Update docs & tests to reflect that unassigned OLD/NEW are now N
@ 2019-01-09 16:35 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-01-09 16:35 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Update docs & tests to reflect that unassigned OLD/NEW are now NULL.

For a long time, plpgsql has allowed trigger functions to parse
references to OLD and NEW even if the current trigger event type didn't
assign a value to one or the other variable; but actually executing such
a reference would fail.  The v11 changes to use "expanded records" for
DTYPE_REC variables changed the behavior so that the unassigned variable
now reads as a null composite value.  While this behavioral change was
more or less unintentional, it seems that leaving it like this is better
than adding code and complexity to be bug-compatible with the old way.
The change doesn't break any code that worked before, and it eliminates
a gotcha that often required extra code to work around.

Hence, update the docs to say that these variables are "null" not
"unassigned" when not relevant to the event type.  And add a regression
test covering the behavior, so that we'll notice if we ever break it
again.

Per report from Kristjan Tammekivi.

Discussion: https://postgr.es/m/CAABK7uL-uC9ZxKBXzo_68pKt7cECfNRv+c35CXZpjq6jCAzYYA@mail.gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/312d21d8635065c14d392b4e5469e7abc03f2bde

Modified Files
--------------
doc/src/sgml/plpgsql.sgml                       |  4 +--
doc/src/sgml/release-11.sgml                    | 18 ++++++++++++-
src/pl/plpgsql/src/Makefile                     |  2 +-
src/pl/plpgsql/src/expected/plpgsql_trigger.out | 36 +++++++++++++++++++++++++
src/pl/plpgsql/src/pl_exec.c                    | 11 ++++----
src/pl/plpgsql/src/sql/plpgsql_trigger.sql      | 24 +++++++++++++++++
6 files changed, 86 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-01-09 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 16:35 pgsql: Update docs & tests to reflect that unassigned OLD/NEW are now N Tom Lane <tgl@sss.pgh.pa.us>
2019-01-09 16:35 pgsql: Update docs & tests to reflect that unassigned OLD/NEW are now N Tom Lane <tgl@sss.pgh.pa.us>

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