Re: proposal - assign result of query to psql variable - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal - assign result of query to psql variable
Date
Msg-id CAFj8pRAtzFjqqvMDCskLOqjbyF0Wouu7SuXGVUkhVQ4S58MwfQ@mail.gmail.com
Whole thread Raw
In response to Re: proposal - assign result of query to psql variable  (Shigeru Hanada <shigeru.hanada@gmail.com>)
List pgsql-hackers
2013/2/2 Shigeru Hanada <shigeru.hanada@gmail.com>:
> On Sat, Feb 2, 2013 at 7:30 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> possible variants
>>
>> a) don't store NULL  values - and remove existing variable when NULL
>> be assigned - it is probably best, but should be confusing for users
>> b) implement flag IS NULL - for variables
>> c) use nullPrint
>> d) use empty String
>
> +1 for a).  If users want to determine whether the result was NULL, or
> want to use substitute string for NULL result, they can use coalesce
> in SELECT clause.  Anyway the feature should be documented clearly.
>

yes, this has one other advantage - it doesn't block possible
enhancing variables about NULL support in future. And other - it
doesn't depends on psql settings

Regards

Pavel

> --
> Shigeru HANADA



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: GetOldestXmin going backwards is dangerous after all
Next
From: Noah Misch
Date:
Subject: Re: COPY FREEZE has no warning