Re: proposal - assign result of query to psql variable

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Phil Sorber <phil(at)omniti(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - assign result of query to psql variable
Date: 2013-02-02 14:43:46
Message-ID: CAFj8pRAtzFjqqvMDCskLOqjbyF0Wouu7SuXGVUkhVQ4S58MwfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/2/2 Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>:
> On Sat, Feb 2, 2013 at 7:30 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2013-02-02 14:51:13 Re: COPY FREEZE has no warning
Previous Message Andres Freund 2013-02-02 14:24:37 Re: GetOldestXmin going backwards is dangerous after all