pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Verite <daniel@manitou-mail.org>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Subject: Re: Variable substitution in psql backtick expansion
Date: Mon, 03 Apr 2017 10:16:18 -0400
Message-ID: <12587.1491228978@sss.pgh.pa.us> (raw)
In-Reply-To: <ae3900f7-3064-4d4c-8e9d-673ac8bbb911@manitou-mail.org>
References: <ae3900f7-3064-4d4c-8e9d-673ac8bbb911@manitou-mail.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

"Daniel Verite" <daniel@manitou-mail.org> writes:
> Let's imagine that psql would support a syntax like this:
>   \if [select current_setting('server_version_num')::int < 110000]
> or
>   \if [select 1 from pg_catalog.pg_extension where extname='pgcrypto']

I really dislike this syntax proposal.  It would get us into having
to count nested brackets, and distinguish quoted from unquoted brackets,
and so on ... and for what?  It's not really better than

   \if sql select 1 from pg_catalog.pg_extension where extname='pgcrypto'

(ie, "\if sql ...text to send to server...").

If you're worried about shaving keystrokes, make the "select" be implicit.
That would be particularly convenient for the common case where you're
just trying to evaluate a boolean expression with no table reference.

			regards, tom lane


-- 
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: <12587.1491228978@sss.pgh.pa.us>
Permalink:  ../12587.1491228978@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12587.1491228978@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, daniel@manitou-mail.org, coelho@cri.ensmp.fr
  Subject: Re: Variable substitution in psql backtick expansion
  In-Reply-To: <12587.1491228978@sss.pgh.pa.us>

* 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