From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christophe Pettus <xof@thebuild.com>
Cc: stan <stanb@panix.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Can I trigger an action from a coalesce ?
Date: Sat, 22 Feb 2020 17:36:14 -0500
Message-ID: <8812.1582410974@sss.pgh.pa.us> (raw)
In-Reply-To: <1B2A9F19-0477-473F-B6E6-7CBE393C8D38@thebuild.com>
References: <20200222210206.GA17445@panix.com>
<35c60adc-3f02-13ad-a4a6-48642a1185d8@aklaver.com>
<BF12101F-CC34-4C75-B770-78B544AEEB70@thebuild.com>
<20200222213325.GA22785@panix.com>
<982511F6-2957-43EE-8A28-3A5541B56ADF@thebuild.com>
<7426.1582408953@sss.pgh.pa.us>
<1B2A9F19-0477-473F-B6E6-7CBE393C8D38@thebuild.com>
Christophe Pettus <xof@thebuild.com> writes:
>> On Feb 22, 2020, at 14:02, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> It's a really bad idea to mark a function that has side-effects
>> (i.e., emitting a NOTICE) as immutable, especially if the occurrence
>> of the side-effect at well-defined times is exactly what you're
>> desirous of.
> True, and it doesn't actually need to be immutable here; just cut and pasted from the wrong example.
> (That being said, I'm not coming up with a specific bad thing that a RAISE NOTICE in an immutable function will cause. Is there one?)
The problem that I'm worried about is premature evaluation of the
"immutable" function, causing the NOTICE to come out once during
query planning, independently of whether/how many times it should
come out during execution.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, xof@thebuild.com, stanb@panix.com
Subject: Re: Can I trigger an action from a coalesce ?
In-Reply-To: <8812.1582410974@sss.pgh.pa.us>
References: <20200222210206.GA17445@panix.com> <35c60adc-3f02-13ad-a4a6-48642a1185d8@aklaver.com> <BF12101F-CC34-4C75-B770-78B544AEEB70@thebuild.com> <20200222213325.GA22785@panix.com> <982511F6-2957-43EE-8A28-3A5541B56ADF@thebuild.com> <7426.1582408953@sss.pgh.pa.us> <1B2A9F19-0477-473F-B6E6-7CBE393C8D38@thebuild.com> <8812.1582410974@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox