Improving "missing FROM-clause entry" message

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Improving "missing FROM-clause entry" message
Дата
Msg-id 10406.1135616958@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: Improving "missing FROM-clause entry" message  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I'm thinking about whether we can't improve the message for "missing
FROM-clause entry" to somehow account for situations where the table
does exist in the query but it's referenced from an improper place,
as in bug #2130 (filed a couple hours ago, not yet visible in mail list
archives):

SELECT ... FROM a, b LEFT JOIN c ON (c.task_id=a.task_id ...

This seems to come up often enough in porting MySQL code that we ought
to try to deliver a more specific error message for it.

We can fairly easily modify warnAutoRange() to check whether the target
name exists anywhere in the ParseState's range table.  This would not
detect forward references, as in

SELECT ... FROM b LEFT JOIN c ON (c.task_id=a.task_id ...), a ...

but I think this is acceptable since that case isn't going to occur
in ported MySQL code.

What I'm wondering about is how to word the error message.  A
minimum-change approach would be to add a HINT, but I'm thinking
it'd be better to replace the message entirely:
ERROR: reference to table "a" is not allowed from this locationHINT: JOIN clauses cannot refer to tables outside the
JOIN

Any thoughts about it?  Are there any cases where the existing message
wording is preferable even though a matching RTE does exist?
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Fixing row comparison semantics
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Improving "missing FROM-clause entry" message