pgsql: Fix write/read of empty string fields in Nodes.

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix write/read of empty string fields in Nodes.
Date: 2022-09-26 13:32:57
Message-ID: E1ocoEC-00269r-II@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://www.postgresql.org/message-id/flat/4159834(dot)1657405226(at)sss(dot)pgh(dot)pa(dot)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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-09-26 13:40:59 Re: pgsql: Fix write/read of empty string fields in Nodes.
Previous Message Peter Eisentraut 2022-09-26 11:23:01 pgsql: Translation updates