Re: Better error message for a small problem with WITH RECURSIVE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Better error message for a small problem with WITH RECURSIVE
Дата
Msg-id 27619.1223470240@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Better error message for a small problem with WITH RECURSIVE  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Yes, please. At least DB2 allows recursive queries without the 
> "RECURSIVE" keyword, just "WITH" is enough. Without a hint, anyone 
> migrating from such a system will spend hours looking at the query, 
> seeing nothing wrong.

Huh, interesting ... so they're violating the letter of the spec
as to WITH name scope.

Anyway, here's what we do as of last night:

regression=# with q(x) as (select 1 union all select x+1 from q where x<10)
select * from q;
ERROR:  relation "q" does not exist
LINE 1: with q(x) as (select 1 union all select x+1 from q where x<1...
      ^
 
DETAIL:  There is a WITH item named "q", but it cannot be referenced from this part of the query.
HINT:  Use WITH RECURSIVE, or re-order the WITH items to remove forward references.
        regards, tom lane


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

Предыдущее
От: Emmanuel Cecchet
Дата:
Сообщение: Re: Transactions and temp tables
Следующее
От: Emmanuel Cecchet
Дата:
Сообщение: Building Postgres in Eclipse