"Klaus Guntermann" <guntermann(dot)kl(at)pvw(dot)tu-darmstadt(dot)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
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
regression=# select dummy.myfield from dummy where dummy.myfield=1 union
regression-# select dummy.myfield from dummy where dummy.myfield=2 order by
ERROR: missing FROM-clause entry for table "dummy"
LINE 3: dummy.myfield;
which should help at least a little.
regards, tom lane
In response to
pgsql-bugs by date
|Next:||From: Yu-Lung Shao||Date: 2006-06-17 04:47:02|
|Subject: BUG #2484: pg_dump not support < redirect|
|Previous:||From: Bruce Momjian||Date: 2006-06-16 21:21:21|
|Subject: Re: [Win32] Problem with rename()|