Re: Undefined psql variables

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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 20:33:06
Message-ID: alpine.DEB.2.20.1704022221390.9265@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello,

>> For checking variable definition, I would suggest to extend the variable
>> access syntax so that there is no exception to the one thing rule between
>> client side and server side evaluation:
>
>> \if :?variable
>
> Don't like that one bit;

Possibly:-)

This is kind of a shell-like hack ${VAR:?error-message-if-not-defined},
or ${#VAR} to get a length.

They are not likable but they do the job.

> you're going to run out of namespace there in no time.

I do not undestand where there would be a namespace issue. Is that under
the assumption that ":?xxx" is frequently used in SQL?

> And you don't have a very good way to say "if not defined", either.

Indeed. I'm afraid that handling "NOT" client-side would be necessary with
this approach, so the decision would be 1 thing or 2 things where the
first one is "NOT" would be handled client-side.

--
Fabien.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-04-02 20:57:00 Re: Undefined psql variables
Previous Message Jan Michálek 2017-04-02 20:28:40 Re: Other formats in pset like markdown, rst, mediawiki