Re: Undefined psql variables - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: Undefined psql variables
Date
Msg-id alpine.DEB.2.20.1704022221390.9265@lancre
Whole thread Raw
In response to Re: Undefined psql variables  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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.



pgsql-hackers by date:

Previous
From: Jan Michálek
Date:
Subject: Re: Other formats in pset like markdown, rst, mediawiki
Next
From: Fabien COELHO
Date:
Subject: Re: Undefined psql variables