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

From: Moshe Jacobson <moshe(at)neadwerx(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Bug? Function with side effects not evaluated in CTE
Date: 2013-10-21 16:43:21
Message-ID: CAJ4CxLmMzOeAzvm8Lf=Ae8ckdfyxAH85fO8NVgGY5kS1CZKu1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 18, 2013 at 5:08 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:

> this thread hasn't really provided a compelling use-case for making a
> change: the example
> provided is too contrived.
>

It seems contrived because I distilled it down from what it originally was.
There is an actual use case in which this was failing:
We use stored procs to provide us the functionality of an UPSERT, which
PostgreSQL lacks.
We are using this in the first CTE to create new entries in a table, and we
are using the DELETE to delete the entries that already existed that we
didn't just create.
I am of the belief that if the function in a CTE is volatile, that it
should be executed unconditionally.

Moshe Jacobson
Manager of Systems Engineering, Nead Werx Inc. <http://www.neadwerx.com>
2323 Cumberland Parkway · Suite 201 · Atlanta, GA 30339

"Quality is not an act, it is a habit." -- Aristotle

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2013-10-21 17:35:33 Re: [HACKERS] Who is pgFoundery administrator?
Previous Message Torsten Förtsch 2013-10-21 16:38:06 locks held during commit with synchronous replication