Re: Variable substitution in psql backtick expansion

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Variable substitution in psql backtick expansion
Date: 2017-11-13 06:13:57
Message-ID: alpine.DEB.2.20.1711130703260.15385@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Tom & Michaël,

>> I think this patch should be rejected.
> +1 for rejection [...]

The noes have it!

Note that the motivation was really symmetric completion:

fabien=# \echo :VERSION_NAME
11devel
fabien=# \echo :VERSION_NUM
110000
fabien=# \echo :VERSION
PostgreSQL 11devel on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit
fabien=# \echo :SERVER_VERSION_NAME
10.1
fabien=# \echo :SERVER_VERSION_NUM
100001

But

fabien=# \echo :SERVER_VERSION
:SERVER_VERSION

To get it into a variable the work around is really:

fabien=# SELECT version() AS "SERVER_VERSION" \gset
fabien=# \echo :SERVER_VERSION
PostgreSQL 10.1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit

--
Fabien

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message amul sul 2017-11-13 07:11:23 Re: pgsql: Add hash partitioning.
Previous Message Dilip Kumar 2017-11-13 04:42:57 Re: Proposal: Improve bitmap costing for lossy pages