By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,372 Members | 1,950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,372 IT Pros & Developers. It's quick & easy.

order by is ambiguous

P: n/a
I could not find any discussion on this but imho this seems an erroneous
error occuring now in 7.3.4 (after upgrade from 7.2.3):

select null::time, 'test'::varchar as time order by time;
ERROR: ORDER BY 'time' is ambiguous

The solution is to name the time datatype e.g.

select null::time as xyz, 'test'::varchar as time order by time;

Regards,
Alfred
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Travel Jadoo <ja***@xs4all.nl> writes:
I could not find any discussion on this but imho this seems an erroneous
error occuring now in 7.3.4 (after upgrade from 7.2.3): select null::time, 'test'::varchar as time order by time;
ERROR: ORDER BY 'time' is ambiguous


What's erroneous about it? You have two output columns named 'time'.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #2

P: n/a
On Thu, 2004-01-08 at 16:09, Tom Lane wrote:
Travel Jadoo <ja***@xs4all.nl> writes:
I could not find any discussion on this but imho this seems an erroneous
error occuring now in 7.3.4 (after upgrade from 7.2.3):

select null::time, 'test'::varchar as time order by time;
ERROR: ORDER BY 'time' is ambiguous


What's erroneous about it? You have two output columns named 'time'.

regards, tom lane


Hmm but the first one has actually no name, it's just casted as datatype
time. I now realise that casted columns get assigned the datatype as
name. Should it not show ?column? as output just like you a "select
null;" would do?

This actually came up as I have multiple time fields but only one was
named time by me.

Regards,
Alfred

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #3

P: n/a
> Hmm but the first one has actually no name, it's just casted as datatype
time. I now realise that casted columns get assigned the datatype as
name. Should it not show ?column? as output just like you a "select
null;" would do?


i think you're confusing what the front end uses as a default column
heading with what the back end uses as a default column name. '?column?'
would probably not meet SQL standards.
--
Mike Nolan

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.