Re: Variable substitution in psql backtick expansion - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: Variable substitution in psql backtick expansion
Date
Msg-id alpine.DEB.2.20.1704032118250.23892@lancre
Whole thread Raw
In response to Re: Variable substitution in psql backtick expansion  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Variable substitution in psql backtick expansion
List pgsql-hackers
Hello Tom,

>>   \if [select current_setting('server_version_num')::int < 110000]
>
> 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'

Hmmm. On the positive side, it looks more expression-like, and it allows 
to think of handling a multi-line expression on day.

ISTM that the lexer already counts parentheses, so maybe using external 
parentheses might work without much effort?

> (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.

I'm looking for a solution to avoid the suggested "sql" prefix, because "I 
really dislike this proposal", as you put it.

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: Variable substitution in psql backtick expansion
Next
From: Andrew Dunstan
Date:
Subject: Re: [PATCH] few fts functions for jsonb