misplaced GUC in pqcomm.h -- where to put actual common variable though...? - Mailing list pgsql-hackers

From Greg Stark
Subject misplaced GUC in pqcomm.h -- where to put actual common variable though...?
Date
Msg-id CAM-w4HMmBmMxPisbMOb_JTEHbYL5VvG0f-0U9wUbZ=1XFBKJ1g@mail.gmail.com
Whole thread Raw
List pgsql-hackers
So back in 2002 in 7.3 there was a commit 2c6b34d9598 which added a
GUC db_user_namespace which is stored in a variable Db_user_namespace.
All that seems fine except...

The variable this GUC is stored in is Db_user_namespace which... is
actually declared in pqcomm.h which is intended to be "Definitions
common to frontends and backends".

Afaics it's never actually defined in any FE code, neither libpq nor
any clients. I was a bit surprised this isn't producing a warning
about an extern declaration that's never defined but I guess that's
not actually that unusual.

The actual variable is defined in the backend in postmaster.c. I'm
guessing this declaration can just move to libpq/libpq.h which
(counterintuitively) is for the backend iiuc.

I don't think this causes any actual problems aside from namespace
pollution but it confused me.  I found this because I was looking for
where to put the ALPN protocol version which (at least at the moment)
would be the same for the server and client. But as far as I can tell
it would be the only variable (other than the above) declared in both
and that means there's no particularly handy place to put the
definition.

--
greg



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry
Next
From: Masahiko Sawada
Date:
Subject: Re: Initial Schema Sync for Logical Replication