Re: Undefined psql variables - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: Undefined psql variables
Date
Msg-id alpine.DEB.2.20.1704022135130.9265@lancre
Whole thread Raw
In response to [HACKERS] Undefined psql variables  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: Undefined psql variables
List 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.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Variable substitution in psql backtick expansion
Next
From: Fabien COELHO
Date:
Subject: Re: Variable substitution in psql backtick expansion