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

Re: top-level DML under CTEs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: top-level DML under CTEs
Date: 2010-09-14 19:51:56
Message-ID: 11301.1284493916@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-rrreviewers
Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
> 2010/9/15 Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Marko TiikkajaDate: 2010-09-14 20:28:33
Subject: Re: top-level DML under CTEs
Previous:From: Heikki LinnakangasDate: 2010-09-14 19:48:50
Subject: Re: Serializable Snapshot Isolation

pgsql-rrreviewers by date

Next:From: Marko TiikkajaDate: 2010-09-14 20:28:33
Subject: Re: top-level DML under CTEs
Previous:From: Hitoshi HaradaDate: 2010-09-14 18:59:43
Subject: Re: top-level DML under CTEs

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