Neil Conway <neilc@samurai.com> writes:
> The historical origins of the feature are no excuse for its
> deficiencies.
On the other hand, the alleged deficiencies are not bad enough to
justify making non-backwards-compatible changes. If we were getting
routine complaints from the field I might be willing to break things in
order to address the issue. But we're not --- AFAIR you are the first
to raise the point at all.
> On second thought, there's another alternative. Rather than improving
> \set, we could invent a new mechanism for setting psql-internal
> variables, and leave the \set stuff to user-defined variables.
I was toying with the idea of inventing a "\declare foo" command
(which would error out if the variable foo already exists), along with
an optional setting that makes psql complain about either use of or
assignment to an undeclared variable. As long as latter setting is
false the behavior is backwards-compatible. By setting it true you get
the sort of error checking you're after.
regards, tom lane