Re: wCTE behaviour

From: David Fetter <david(at)fetter(dot)org>
To: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Yeb Havinga <yebhavinga(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: wCTE behaviour
Date: 2010-11-13 18:44:25
Message-ID: 20101113184425.GA16128@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 13, 2010 at 05:23:34PM +0200, Marko Tiikkaja wrote:
> On 2010-11-13 5:08 PM +0200, Tom Lane wrote:
> >Marko Tiikkaja<marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi> writes:
> >>On 13 Nov 2010, at 15:41, David Fetter<david(at)fetter(dot)org> wrote:
> >>>Similarly, if a normal CTE called a data-changing function but
> >>>was nevertheless not referred to, it would still run.
> >
> >>Actually, it wouldn't.
> >
> >Indeed, and that was considered a feature when we did it. I think
> >that having wCTEs behave arbitrarily differently on this point
> >might be a bad idea.
>
> So these queries would behave differently?
>
> WITH t AS (DELETE FROM foo RETURNING *) SELECT 1 WHERE false;
>
> WITH t AS (DELETE FROM foo RETURNING *) SELECT 1 FROM t LIMIT 0;

No.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2010-11-13 18:46:46 Re: wCTE behaviour
Previous Message Tom Lane 2010-11-13 18:42:36 Re: HOT updates in index-less tables