Re: Writeable CTEs and empty relations

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Writeable CTEs and empty relations
Date: 2010-02-14 04:47:54
Message-ID: 603c8f071002132047t56813fd8kafdcd9b5741fabc1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 12, 2010 at 9:31 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Fri, Feb 12, 2010 at 8:06 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> We could possibly put in some hack to disallow OLD/NEW references in
>>> the WITH queries, but that got past my threshold of ugliness, so
>>> I'm not going to commit it without further discussion.
>
>> On the face of it it's not obvious to me why you wouldn't just do
>> that.  If it's not valid to reference them there, then just don't let
>> it happen (now comes the part where you tell me why it's not that
>> simple).
>
> Well, there's no obvious-to-the-user reason why it shouldn't work.
> If we hack it, then an example like I gave will give a "no such
> table" error, and I'll bet long odds we'll get bug reports about it.
>
> (Now maybe we could suppress the bug reports if we could get it to
> print something more like "NEW can't be referenced in WITH", but
> doing that seems significantly harder --- the way that I can see
> to do it would be to not have NEW/OLD in the namespace while parsing
> WITH, and that would lead to a pretty stupid error message.)

Oh, I get it. I thought you were saying that it was semantically
nonsensical, but now I think you're saying that there's some
implementation artifact that prevents us from supporting it.
Personally, I don't use NEW and OLD in UPDATE queries, so it wouldn't
bother me to just disallow them, but (1) I might be in the minority
and (2) even if I'm not, the ugliness factor is something to consider.
So I'm not sure what the right thing to do is, but we need to make up
our mind...

If we do decide to hold off on this, then we should probably have a
discussion of what the right way to fix the rule issues is for 9.1.
If there's no non-ugly way to do this, then we might as well go ahead
and do something ugly. If there is a non-ugly way to fix it, we
should figure out what it is so that those who may be interested in
having this feature can see about coding it up.

...Robert

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-02-14 05:29:45 Re: idle in txn query cancellation
Previous Message Robert Haas 2010-02-14 04:34:51 CommitFest Status Summary - 2010-02-14