Gregory Stark <[EMAIL PROTECTED]> writes:
> Peter Eisentraut <[EMAIL PROTECTED]> 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, you can 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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to