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

From Fabien COELHO
Subject Re: Variable substitution in psql backtick expansion
Date
Msg-id alpine.DEB.2.20.1704022144470.9265@lancre
Whole thread Raw
In response to Re: Variable substitution in psql backtick expansion  (Corey Huinker <corey.huinker@gmail.com>)
List pgsql-hackers
> src/tools/msvc/Solution.pm:s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x)
> #x\n#define __STRINGIFY2(z) __STRINGIFY(z)\n#define PG_VERSION_STR
> "PostgreSQL $self->{strver}$extraver, compiled by Visual C++ build "
> __STRINGIFY2(_MSC_VER) ", $bits-bit"};

Well, this is the same hack.

> Without digging too deep, it seems like the redefinition wouldn't be
> harmful, but it might make sense to not use the name STRINGIFY() if only to
> avoid confusion with Solution.pm.

It is the usual name for these macro. What would you suggest?

>>  - how desirable/useful is it to have this in 10?
>
> Extensions and extension-ish packages will love the _NUM vars.

Hmmmm. I'm afraid pg extension scripts (for CREATE EXTENSION) are not 
executed through psql, but server side directly, so there is not much 
backslash-command support.

> There's a lesser need for the _NAME vars.

I put them more for error reporting, eg:
  \if :VERSION_NUM < 110000    \echo :VERSION_NAME is not supported, should be at least 11.0    \q  \endif

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: Undefined psql variables
Next
From: Tom Lane
Date:
Subject: Re: Undefined psql variables