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

Re: top-level DML under CTEs

From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: top-level DML under CTEs
Date: 2010-09-15 01:04:06
Message-ID: AANLkTim4rdhh1u9rvxvfi8xnXRMJ0ZM_JMdZfX4RjwVz@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-rrreviewers
2010/9/15 Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>:
> On 2010-09-14 10:51 PM, Tom Lane wrote:
>> My recollection is that whether a CTE is marked RECURSIVE or not affects
>> its scope of visibility, so that confusing the two cases can result in
>> flat-out incorrect parser behavior.
>
> The worst I can think of is:
>
> CREATE TABLE foo(a int);
>
> WITH t AS (SELECT * FROM foo)
> INSERT INTO bar
> WITH RECURSIVE foo (SELECT 1 AS a)
> SELECT * FROM t;
>
> t will actually be populated with the results of the CTE, not the table foo.

Hmmm, that's true. But it seems unrelated to RECURSIVE option, right?

Regards,



-- 
Hitoshi Harada

In response to

pgsql-hackers by date

Next:From: Hitoshi HaradaDate: 2010-09-15 01:15:12
Subject: Re: top-level DML under CTEs
Previous:From: Robert HaasDate: 2010-09-15 00:44:03
Subject: Re: Pseudoconstant quals versus the join removal patch

pgsql-rrreviewers by date

Next:From: Hitoshi HaradaDate: 2010-09-15 01:15:12
Subject: Re: top-level DML under CTEs
Previous:From: Tom LaneDate: 2010-09-14 23:02:25
Subject: Re: top-level DML under CTEs

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