Re: Variable substitution in psql backtick expansion

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Daniel Verite <daniel(at)manitou-mail(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Variable substitution in psql backtick expansion
Date: 2017-04-02 07:52:25
Message-ID: alpine.DEB.2.20.1704020947290.4632@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> For this case can be nice to have function that returns server version as
> number
>
> some like version_num() .. 10000

Another possible trick to get out of a script which does not support \if,
relying on the fact that the unexpected command is simply ignored:

-- exit version below 10
\if false
\echo 'script requires version 10 or better'
\q
\endif

Also possible but less informative on errors:

\set ON_ERROR_STOP on
\if false \endif

--
Fabien.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2017-04-02 09:21:06 Re: Performance improvement for joins where outer side is unique
Previous Message Fabien COELHO 2017-04-02 07:45:52 Re: Variable substitution in psql backtick expansion