Re: Can I trigger an action from a coalesce ?

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: stan <stanb(at)panix(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Can I trigger an action from a coalesce ?
Date: 2020-02-22 21:06:57
Message-ID: BF12101F-CC34-4C75-B770-78B544AEEB70@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Feb 22, 2020, at 13:05, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>
> On 2/22/20 1:02 PM, stan wrote:
>> I have a case where if a value does not exist, I am going to use a default,
>> which is easy with coalesce. But I would like to warn the user that a
>> default has been supplied. The default value is reasonable, and could
>> actually come from the source table, so I can't just check the value.
>> I'd like to do a raise NOTICE, if the default portion of the coalesce fires.
>> Anyone have a good way to accomplish this?
>
> No.

You can, of course, create a PL/pgSQL function and use that as the default.

--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-02-22 21:10:12 Re: How to fix 0xC0000005 exception in Postgres 9.0
Previous Message Adrian Klaver 2020-02-22 21:05:32 Re: Can I trigger an action from a coalesce ?