Re: Variable substitution in psql backtick expansion
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Greg Stark <stark@mit.edu>, Daniel Verite <daniel@manitou-mail.org>,
Tom Lane <tgl@sss.pgh.pa.us>,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-04-11T06:56:53Z
Lists: pgsql-hackers
Hello Pavel, > I think so some local expression evaluation could be - but it should not be > placed in \if statement Why? > \expr issupported :VERSION_NUM >= 10000 Hmmm. Although I do not buy this, it could work as a replacement for \set which it seems cannot be upgraded because some people may rely on it to just store whatever comes after it in a variable. Maybe \setexpr or \set_expr because it is setting a variable and there is already a \set. > \if :issuported > > maybe \if can support the basic logic predicates NOT, OR, AND - ISTM that "NOT" is a minimal requirement, and the easy one. Note that OR & AND imply a syntax tree, handling parentheses, not in the same league. > but the operands can be only evaluated variables. Why? If your idea was to be followed, it seems to suggest two parsers with different constraints, one for the suggested "\expr" and one for the existing "\if". I think that if there is a client expression lexer/parser/executor, there would be just one of them for one syntax. Two is one too many. -- Fabien.
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