psql variables fixed (?)

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: hackers(at)postgresql(dot)org
Subject: psql variables fixed (?)
Date: 2000-01-14 22:25:36
Message-ID: Pine.LNX.4.21.0001140011200.1917-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-01-14 22:25:44 Re: [HACKERS] psql -f inconsistency with "copy from stdin"
Previous Message Peter Eisentraut 2000-01-14 22:11:12 Help from a Windows programmer needed!