Re: BUG #3320: Error when using INSERT...RETURNING as a subquery

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, David Fetter <david(at)fetter(dot)org>, Jan Szumiec <jan(dot)szumie(at)infiniteloop(dot)eu>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3320: Error when using INSERT...RETURNING as a subquery
Date: 2007-05-30 17:00:32
Message-ID: 1180544432.26915.116.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 2007-05-29 at 22:41 -0400, Tom Lane wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> > On Tue, 2007-05-29 at 18:10 +0100, Gregory Stark wrote:
> >> It has the same problem that SELECT triggers have. How many rows should you
> >> expect that subquery to insert, update, or delete if it's used in a join
> >> clause? Or in the where clause of another insert/update/delete statement?
>
> > We could handle it essentially like a volatile set-returning function.
>
> Uh-huh. Please provide a concise, accurate definition of what that
> does. For extra points, be sure it describes the behavior of all recent
> Postgres versions. (And after that, we could argue about whether we
> actually *like* the described behavior ... which I'll bet we won't.)
>

I understand that we don't make many guarantees about when and how many
times volatile functions are executed (the most obvious example is the
WHERE clause).

I also understand the argument that we don't want to extend that
uncertainty to UPDATE ... RETURNING.

It is possible to define behavior though, because it's already done for
volatile functions. Even if it's not a good definition, and even if that
definition changes between versions and is non-deterministic, it seems
like it offers some kind of starting place.

Regards,
Jeff Davis

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Pedro Gimeno Fortea 2007-05-30 17:21:00 Re: BUG #3319: Superuser can't revoke grants on a schema given by aother user
Previous Message Tom Lane 2007-05-30 16:57:39 Re: BUG #3319: Superuser can't revoke grants on a schema given by aother user