pgsql: Code review for GUC serialization/deserialization code. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Code review for GUC serialization/deserialization code.
Date
Msg-id E1c8BHQ-0002Sp-B8@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Code review for GUC serialization/deserialization code.

The serialization code dumped core for a string-valued GUC whose value
is NULL, which is a legal state.  The infrastructure isn't capable of
transmitting that state exactly, but fortunately, transmitting an empty
string instead should be close enough (compare, eg, commit e45e990e4).

The code potentially underestimated the space required to format a
real-valued variable, both because it made an unwarranted assumption that
%g output would never be longer than %e output, and because it didn't count
right even for %e format.  In practice this would pretty much always be
masked by overestimates for other variables, but it's still wrong.

Also fix boundary-case error in read_gucstate, incorrect handling of the
case where guc_sourcefile is non-NULL but zero length (not clear that can
happen, but if it did, this code would get totally confused), and
confusingly useless check for a NULL result from read_gucstate.

Andreas Seltenreich discovered the core dump; other issues noted while
reading nearby code.  Back-patch to 9.5 where this code was introduced.

Michael Paquier and Tom Lane

Discussion: <871sy78wno.fsf@credativ.de>

Branch
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/272c426604e249157e99394ec1b81e9594783ab0

Modified Files
--------------
src/backend/utils/misc/guc.c | 52 ++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 21 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Add pg_sequences view
Next
From: Tom Lane
Date:
Subject: pgsql: Code review for GUC serialization/deserialization code.