Re: Undefined psql variables

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Undefined psql variables
Date: 2017-01-23 18:07:14
Message-ID: CAFj8pRBe+vffjF22j29yj=LHo+c=X6tjpHOdmnHDXHdZRW0DQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-01-23 18:53 GMT+01:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Corey Huinker <corey(dot)huinker(at)gmail(dot)com> writes:
> > I was giving some thought to how psql handles undefined variables.
> > I would like an option where either psql can provide an alternate value
> > when an undefined variable is referenced, or a way to detect that a
> > specific variable is undefined and replace it with a defined variable.
>
> This seems pretty bizarre. What's the use case? Why would it not
> be better to build the behavior out of other spare parts, along the
> lines of COALESCE or perhaps
>
> \if not defined(x)
> \set x y
> \fi
>
> Obviously the \if stuff is things we don't have yet either, but
> it seems less likely to have surprising side-effects.
>

Some form of DEFINED has more sense than COALESCE in this case. We can
introduce some predefined client side functions available only in \if
\elsif statements.

Regards

Pavel

>
> regards, tom lane
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2017-01-23 18:09:20 Allowing nonzero return codes from \quit
Previous Message Corey Huinker 2017-01-23 18:04:04 Re: Undefined psql variables