pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Daniel Verite <daniel@manitou-mail.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Subject: Re: Variable substitution in psql backtick expansion
Date: Sun, 2 Apr 2017 09:52:25 +0200 (CEST)
Message-ID: <alpine.DEB.2.20.1704020947290.4632@lancre> (raw)
In-Reply-To: <CAFj8pRDCfLLNfMyNAjDwgHXS7inThdqgCaSbfKpiYXkb6Mvmwg@mail.gmail.com>
References: <bc15034d-b421-42ac-89b1-c3485fa1728b@manitou-mail.org>
	<alpine.DEB.2.20.1704020841490.4632@lancre>
	<CAFj8pRDCfLLNfMyNAjDwgHXS7inThdqgCaSbfKpiYXkb6Mvmwg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (96+ messages)  latest in thread

Message-ID: <alpine.DEB.2.20.1704020947290.4632@lancre>
Permalink:  ../alpine.DEB.2.20.1704020947290.4632@lancre/
Also on:    postgresql.org/message-id/alpine.DEB.2.20.1704020947290.4632@lancre

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: coelho@cri.ensmp.fr, pavel.stehule@gmail.com, daniel@manitou-mail.org, tgl@sss.pgh.pa.us
  Subject: Re: Variable substitution in psql backtick expansion
  In-Reply-To: <alpine.DEB.2.20.1704020947290.4632@lancre>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox