psql variables fixed (?) - Mailing list pgsql-hackers

From Peter Eisentraut
Subject psql variables fixed (?)
Date
Msg-id Pine.LNX.4.21.0001140011200.1917-100000@localhost.localdomain
Whole thread Raw
Responses Re: psql variables fixed (?)
List pgsql-hackers
I resolved the issue psql variables vs array syntax in the manner
suggested by various people. If the variable is undefined the string will
be untouched. Now something else I'd like to get your comment on is that I
handled the cast operator '::' in the same way, namely so that

=> select 'now'::datetime
will resolve to
=> select 'now':<value of variable "datetime" if defined>

The reason is that otherwise a construct like this
=> \set foo 3
=> select arr.a[2::foo];
or even
=> \set foo 'int4'
=> select x:::foo from y;
won't be possible without introducing an extra syntax trick. And it makes
it consistent throughout.

(Btw., was somebody mentioning that this cast syntax is non-standard and
that he wanted to move toward a standard one? Just wondering.)

However, psql defines some variables by itself, for example the one
containing the last oid. I set up the rule that those variables are always
all upper-case. If something still fails you can always call \unset VAR to
unset it before a query. The list of these variables is in the docs.

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: descriptions on operators
Next
From: Peter Eisentraut
Date:
Subject: pg_pwd