Skip site navigation (1) Skip section navigation (2)

Re: wCTE behaviour

From: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Yeb Havinga <yebhavinga(at)gmail(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Subject: Re: wCTE behaviour
Date: 2011-02-25 00:06:57
Message-ID: 4D66F2A1.6020802@cs.helsinki.fi (view raw or flat)
Thread:
Lists: pgsql-hackers
On 2011-02-25 1:36 AM, Tom Lane wrote:
> Marko Tiikkaja<marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>  writes:
>> I fixed an issue with the portal logic, and now we use
>> PORTAL_ONE_RETURNING for wCTE queries, even if the main query is not a
>> DML or does not have RETURNING.  This also means that we materialize the
>> results of the main query sometimes unnecessarily, but that doesn't look
>> like an easy thing to fix.  PORTAL_ONE_RETURNING as a name is also a bit
>> misleading now, so maybe that needs changing..
>
> Why is it necessary to hack the portal logic at all?  The patch seems to
> work for me without that.  (I've fixed quite a few bugs though, so maybe
> what this is really doing is masking a problem elsewhere.)

Without hacking it broke when PQdescribePrepared was called on a 
prepared query like:

WITH t AS (DELETE FROM foo)
SELECT 1;

Not sure if that's an actual problem, but it seemed like something worht 
fixing.

> Also, why are we forbidding wCTEs in cursors?  Given the current
> definitions, that case seems to work fine too: the wCTEs will be
> executed as soon as you fetch something from the cursor.  Are you
> just worried about not allowing a case that might be hard to support
> later?

Honestly, I have no idea.  It might be a leftover from the previous 
design.  If it looks like it's easy to support, then go for it.


Regards,
Marko Tiikkaja

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2011-02-25 00:07:02
Subject: Re: Fwd: psql include file using relative path
Previous:From: Robert HaasDate: 2011-02-25 00:02:11
Subject: Re: Named restore points

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group