Re: Variable substitution in psql backtick expansion
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Robert Haas <robertmhaas@gmail.com>,
Pavel Stehule <pavel.stehule@gmail.com>,
Corey Huinker <corey.huinker@gmail.com>,
Daniel Verite <daniel@manitou-mail.org>,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-08-26T16:53:45Z
Lists: pgsql-hackers
Fabien COELHO <coelho@cri.ensmp.fr> writes:
> So basically the only thing needed from Robert & you seems to change
> "11.0" to "11devel", which is fine with me.
> The attached v5 does that.
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.
regards, tom lane
Commits
-
Add psql variables showing server version and psql version.
- a6c678f018d3 10.0 landed
- 9ae9d8c1549c 11.0 landed
-
Reformat psql's --help=variables output.
- 3955c8c4eda2 11.0 landed
-
Remove reinvention of stringify macro.
- cd6baed78150 10.0 landed
-
Allow psql variable substitution to occur in backtick command strings.
- f833c847b8fa 10.0 landed