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: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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-15 04:38:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-rrreviewers
2010/9/15 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
>> 2010/9/15 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> Why is it so difficult to do this correctly?
>> Because INSERT INTO ... (SELECT|VALUES) is already a collection of
>> kludge (as comments say). It was possible to parse the two WITHs
>> separately, but it results in ambiguous naming issue;
>> parseWithClause() asserts there's only one WITH clause in the Stmt and
>> detects duplicated CTE name in it.
> Well, I would think that the no-duplication rule applies to each WITH
> list separately, not both together.  If you do something like
> with t1 as (select * from foo)
>  select * from
>    (with t2 as (select * from foo)
>       select * from t1, t2) ss;

Well, I didn't know it is allowed. That would look like the way to go.


Hitoshi Harada

In response to


pgsql-hackers by date

Next:From: SAKAMOTO MasahikoDate: 2010-09-15 05:46:24
Subject: patch: SQL/MED(FDW) DDL
Previous:From: Robert HaasDate: 2010-09-15 03:22:58
Subject: Re: knngist - 0.8

pgsql-rrreviewers by date

Next:From: David FetterDate: 2010-09-16 06:07:09
Subject: Day 01/31
Previous:From: Tom LaneDate: 2010-09-15 03:22:44
Subject: Re: top-level DML under CTEs

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