On Tue, Sep 14, 2010 at 4:28 PM, Marko Tiikkaja
<marko.tiikk...@cs.helsinki.fi> wrote:
> On 2010-09-14 10:51 PM, Tom Lane wrote:
>>
>> Hitoshi Harada<umi.tan...@gmail.com>  writes:
>>>
>>> 2010/9/15 Marko Tiikkaja<marko.tiikk...@cs.helsinki.fi>:
>>>>
>>>> In the email you referred to, Tom was concerned about the case where
>>>> these
>>>> WITH lists have different RECURSIVE declarations.  This patch makes both
>>>> RECURSIVE if either of them is.  I can think of cases where that might
>>>> lead
>>>> to surprising behaviour, but the chances of any of those happening in
>>>> real
>>>> life seem pretty slim.
>>
>>> Does that cause surprising behavior?
>>
>> 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.

Unless I'm confused, that seems pretty clearly wrong.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to