Re: Bug? Function with side effects not evaluated in CTE

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Bug? Function with side effects not evaluated in CTE
Date: 2013-10-21 17:44:04
Message-ID: CAHyXU0zGADVOVG0GFNpgDXPGsZ2g__tzdAf4X9n580DGGKHAHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 18, 2013 at 8:37 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:
> Merlin Moncure-2 wrote
>> Regardless, the point at hand is whether specific plan semantics down
>> the chain can control whether or not volatile expressions should run.
>> Clearly, at least to me, they should not.
>
> Put differently ideally this should be put either on the todo list or the
> "we do not want" list and further inquiries can then go to building up
> enough popular demand to convince someone to implement it. Maybe there
> should be a "convince us" list? Not a todo yet but something still be
> considered.

I would vote it as todo.

> Keeping in mind that there are likely volatile queries relying on the
> current optimization that would become non-optimized and possibly very
> poorly performing. Since the "fix" for these would be a simple alter
> function to make them stable the cost benefit seems worthwhile - since those
> functions are probably mis-identified in the first place due to the use of
> the default.

Any reliance on that behavior would be wrong because it's expressly
contraindicated by the documentation. TBH, If it were not
specifically documented that way, I would be considering this to be
bugged behavior. As for function mis-identification, fair point, but
that's a general problem and not specifically related to CTE
evaluation.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ramistuni 2013-10-21 17:57:42 Upgrade from 9.1 to 9.10
Previous Message Merlin Moncure 2013-10-21 17:35:33 Re: [HACKERS] Who is pgFoundery administrator?