Make "postgres -C guc" print "" not "(null)" for null-valued GUCs.
authorTom Lane <[email protected]>
Wed, 22 Jun 2016 15:55:18 +0000 (11:55 -0400)
committerTom Lane <[email protected]>
Wed, 22 Jun 2016 15:55:32 +0000 (11:55 -0400)
Commit 0b0baf262 et al made this case print "(null)" on the grounds that
that's what happened on platforms that didn't crash.  But neither behavior
was actually intentional.  What we should print is just an empty string,
for compatibility with the behavior of SHOW and other ways of examining
string GUCs.  Those code paths don't distinguish NULL from empty strings,
so we should not here either.  Per gripe from Alain Radix.

Like the previous patch, back-patch to 9.2 where -C option was introduced.

Discussion: <CA+YdpwxPUADrmxSD7+Td=uOshMB1KkDN7G7cf+FGmNjjxMhjbw@mail.gmail.com>

src/backend/postmaster/postmaster.c

index 80136fb663ac1652f51d0e936a7badab5d0cda14..f218bd4501af8dec898ef2eed081539712c3fff8 100644 (file)
@@ -854,7 +854,7 @@ PostmasterMain(int argc, char *argv[])
                const char *config_val = GetConfigOption(output_config_variable,
                                                                                                 false, false);
 
-               puts(config_val ? config_val : "(null)");
+               puts(config_val ? config_val : "");
                ExitPostmaster(0);
        }