Re: [HACKERS] Variable substitution in psql backtick expansion - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] Variable substitution in psql backtick expansion
Date
Msg-id alpine.DEB.2.20.1708261959560.27500@lancre
Whole thread Raw
In response to Re: [HACKERS] Variable substitution in psql backtick expansion  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Variable substitution in psql backtick expansion
List pgsql-hackers
Hello Tom,

> I think you are taking unreasonable shortcuts here:
>
> +    SetVariable(pset.vars, "SERVER_VERSION_NAME", PQparameterStatus(pset.db, "server_version"));
>
> The existing code in connection_warnings() does this:
>
>            const char *server_version;
>
>            /* Try to get full text form, might include "devel" etc */
>            server_version = PQparameterStatus(pset.db, "server_version");
>            /* Otherwise fall back on pset.sversion */
>            if (!server_version)
>            {
>                formatPGVersionNumber(pset.sversion, true,
>                                      sverbuf, sizeof(sverbuf));
>                server_version = sverbuf;
>            }
>
> and I think you should duplicate that logic verbatim.  Now admittedly,
> server_version has been available for a long time, so that this might
> never matter in practice.  But we shouldn't be doing this one way
> in one place and differently somewhere else.

Hmmm. I think this code may have been justified around version 6/7. This 
code could probably be removed: according to the online documentation, 
"server_version" seems supported at least back to 7.4. Greping old sources 
suggest that it is not implemented in 7.3, though.

Spending developer time to write code for the hypothetical someone running 
a psql version 11 linked to a libpq < 7.4, if it can even link, does not 
look like a very good investment... Anyway, here is required the update.

-- 
Fabien.
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: [HACKERS] psql - add ability to test whether a variable exists
Next
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] psql - add ability to test whether a variable exists