Re: BUG #2483: Wrong error report about missing entry in from clause

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2483: Wrong error report about missing entry in from clause
Дата
Msg-id 10807.1150516470@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #2483: Wrong error report about missing entry in from clause  ("Klaus Guntermann" <guntermann.kl@pvw.tu-darmstadt.de>)
Список pgsql-bugs
"Klaus Guntermann" <guntermann.kl@pvw.tu-darmstadt.de> writes:
> with the following simplified example I get a false error message in the
> second select statement, which is almost like the first one.

> select dummy.myfield from dummy where dummy.myfield=1 union
> select dummy.myfield from dummy where dummy.myfield=2 order by
> dummy.myfield;

It's complaining about the invalid qualification of the ORDER BY item.
An ORDER BY attached to a UNION can only use unqualified column names of
the UNION result (ie, it should just be "ORDER BY myfield" or "ORDER BY
1").  I agree that "missing FROM-clause entry" isn't the best possible
error message for that, but it doesn't look simple to improve it.

FWIW, CVS tip (8.2 to be) gives an error cursor pointing at the ORDER BY
item:

regression=# select dummy.myfield from dummy where dummy.myfield=1 union
regression-# select dummy.myfield from dummy where dummy.myfield=2 order by
regression-# dummy.myfield;
ERROR:  missing FROM-clause entry for table "dummy"
LINE 3: dummy.myfield;
        ^
regression=#

which should help at least a little.

            regards, tom lane

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

Предыдущее
От: SAKATA Tetsuo
Дата:
Сообщение: Re: BUG #2480: Installation Error of RMP for RHEL4
Следующее
От: "Yu-Lung Shao"
Дата:
Сообщение: BUG #2484: pg_dump not support < redirect