pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix write/read of empty string fields in Nodes.
2+ messages / 2 participants
[nested] [flat]

* pgsql: Fix write/read of empty string fields in Nodes.
@ 2022-09-26 13:32  Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Peter Eisentraut @ 2022-09-26 13:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix write/read of empty string fields in Nodes.

Historically, outToken has represented both NULL and empty-string
strings as "<>", which readfuncs.c then read as NULL, thus failing
to preserve empty-string fields accurately.  Remarkably, this has
not caused any serious problems yet, but let's fix it.

We'll keep the "<>" notation for NULL, and use """" for empty string,
because that matches other notational choices already in use.
An actual input string of """" is converted to "\""" (this was true
already, apparently as a hangover from an ancient time when string
quoting was handled directly by pg_strtok).

CHAR fields also use "<>", but for '\0'.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8999f5ed3cd7d26be1121d912086d04d134d398b

Modified Files
--------------
src/backend/nodes/outfuncs.c  | 21 ++++++++++++++++++---
src/backend/nodes/readfuncs.c | 14 ++++++++++++--
2 files changed, 30 insertions(+), 5 deletions(-)



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

* Re: pgsql: Fix write/read of empty string fields in Nodes.
@ 2022-09-26 13:40  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2022-09-26 13:40 UTC (permalink / raw)
  To: Peter Eisentraut <peter@eisentraut.org>; +Cc: pgsql-committers@lists.postgresql.org

Peter Eisentraut <peter@eisentraut.org> writes:
> Fix write/read of empty string fields in Nodes.

This really should've included a catversion bump, I think.
Maybe there are no cases where this affects a Node type
we can store today, but I'm unconvinced of that.

			regards, tom lane





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


end of thread, other threads:[~2022-09-26 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 13:32 pgsql: Fix write/read of empty string fields in Nodes. Peter Eisentraut <peter@eisentraut.org>
2022-09-26 13:40 ` 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