Re: top-level DML under CTEs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: top-level DML under CTEs
Дата
Msg-id 24626.1284520964@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: top-level DML under CTEs  (Hitoshi Harada <umi.tanuki@gmail.com>)
Ответы Re: top-level DML under CTEs  (Hitoshi Harada <umi.tanuki@gmail.com>)
Список pgsql-hackers
Hitoshi Harada <umi.tanuki@gmail.com> writes:
> 2010/9/15 Tom Lane <tgl@sss.pgh.pa.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;

there's no expectation that the WITH clauses can't both define the same
name.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: knngist - 0.8
Следующее
От: Hitoshi Harada
Дата:
Сообщение: Re: top-level DML under CTEs