pgsql: Make GetConfigOption/GetConfigOptionResetString return "" for NU

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make GetConfigOption/GetConfigOptionResetString return "" for NU
Date: 2023-11-02 15:53:42
Message-ID: E1qya0r-003brC-Tk@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make GetConfigOption/GetConfigOptionResetString return "" for NULL.

As per the preceding commit, GUC APIs generally expose NULL-valued
string variables as empty strings. Extend that policy to
GetConfigOption() and GetConfigOptionResetString(), eliminating
a crash hazard for unwary callers, as well as a fundamental
ambiguity in GetConfigOption()'s API.

No back-patch, since this is an API change and conceivably somebody
somewhere is depending on this corner case.

Xing Guo, Aleksander Alekseev, Tom Lane

Discussion: https://postgr.es/m/CACpMh+AyDx5YUpPaAgzVwC1d8zfOL4JoD-uyFDnNSa1z0EsDQQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0bc726d95a305ca923b1f284159f40f0d5cf5725

Modified Files
--------------
src/backend/utils/misc/guc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2023-11-02 23:35:56 pgsql: Stabilize postgres_fdw tests on 32-bit machines
Previous Message David Rowley 2023-11-02 10:18:03 pgsql: Attempt to stabilize postgres_fdw tests