Re: Common Table Expressions applied; some issues remain

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Common Table Expressions applied; some issues remain
Дата
Msg-id 2500.1223219973@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Common Table Expressions applied; some issues remain  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: Common Table Expressions applied; some issues remain  ("Dickson S. Guedes" <guediz@gmail.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> Tom Lane wrote:
>>> 2. The patch didn't touch the implicit-RTE code, which means that
>>> 
>>> WITH q AS ( SELECT ... )
>>> SELECT q.*
>>>
>>> will fail even if you've got add_missing_from enabled. 
>> 
>> Yes, it's legacy.  I wouldn't bother.

> The results would be even more suprising if there *is* a table named "q"
> though...

Yeah, the real problem is not so much that it might fail as that it
might silently do something quite different from what you would expect.

CVS HEAD documentation states
 (In fact, the WITH query hides any real table of the same name for the purposes of the primary query. If necessary,
youcan refer to a real table of the same name by schema-qualifying the table's name.)
 

If we don't fix this, I think we'd have to add some disclaimer about
how WITH clauses *don't* hide real tables in the case of implicit RTE
additions.  That seems much uglier than fixing it.

(Hmm, memo to self: I'll bet ruleutils.c's decision about whether it
needs to schema-qualify a reverse-listed table name doesn't take this
into account.)
        regards, tom lane


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

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Common Table Expressions applied; some issues remain
Следующее
От: Tom Lane
Дата:
Сообщение: Re: CYCLE and SEARCH [was Re: Common Table Expressions (WITH RECURSIVE) patch]