Re: Undefined psql variables

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Undefined psql variables
Date: 2017-04-02 19:43:07
Message-ID: alpine.DEB.2.20.1704022135130.9265@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Pavel,

>> I have convinced myself that, unlike pgbench, psql does not really need an
>> advanced client-side-implemented language, so the smaller the better. What
>> I mean by this is that from psql point of view it is ok that the actual
>> expression evaluation is performed server-side. From a user experience
>> point of view it would look similar to pgbench, just the evaluator does not
>> need to be client-side.
>
> I am sorry - I disagree - I don't expect hard scripting in psql too. But
> psql is much more widely used than pgbench - and scripting should be
> intuitive.

I am ok with that objective.

I'm just arguing that for pgbench the evaluator needs to be on the client
side, which implies a lexer, parser and executor. For psql, it does not
really matter where the evaluator is, thus relying on the server should be
fine and simpler and also powerful, provided the necessary information can
be transfered from the client, eg through variable expansion, and maybe
back in the form of special variables to test for errors for instance.

It would not change anything from a syntactic point of view, i.e. it
should indeed be intuitive as you put it, i.e. SQL-like, for instance:

\if current_setting('something') = 'whatever' AND :VERSION_NUM >= 100000
...

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-04-02 19:50:59 Re: Variable substitution in psql backtick expansion
Previous Message Tom Lane 2017-04-02 18:54:02 Re: Variable substitution in psql backtick expansion