Re: top-level DML under CTEs - Mailing list pgsql-hackers

From Tom Lane
Subject Re: top-level DML under CTEs
Date
Msg-id 11301.1284493916@sss.pgh.pa.us
Whole thread Raw
In response to Re: top-level DML under CTEs  (Hitoshi Harada <umi.tanuki@gmail.com>)
Responses Re: top-level DML under CTEs  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
List pgsql-hackers
Hitoshi Harada <umi.tanuki@gmail.com> writes:
> 2010/9/15 Marko Tiikkaja <marko.tiikkaja@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.

It would probably be all right to combine the cases internally, at the
rewriter or planner stage.  It's not okay to do it in the parser, not
even after doing parse analysis of the individual CTEs, because then it
would be impossible for ruleutils.c to reverse-list the query correctly.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Serializable Snapshot Isolation
Next
From: Marko Tiikkaja
Date:
Subject: Re: top-level DML under CTEs