Bugs item #2787448, was opened at 2009-05-05 18:52
Message generated for change (Comment added) made by nielsnes
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2787448&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL/Core
Group: MonetDB5 CVS Head
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Stefan de Konink (skinkie)
Assigned to: Niels Nes (nielsnes)
Summary: Better error message for count(*) vs order by

Initial Comment:
sql>select count(*) from way_tags, mytemp, mytemp2 where k= 'highway' and v = 
'unclassified' and way_tags.way = mytemp2.way and mytemp2.segment = mytemp.row 
order by mytemp2.way, mytemp2.segment;
!SELECT: no such column 'mytemp2.way'

It took me some while to figure out that count(*) didn't like order by.

----------------------------------------------------------------------

>Comment By: Niels Nes (nielsnes)
Date: 2009-05-28 20:12

Message:
order by is defined on the result columns, ie if there are no columns (only
an unnamed count(*)) the order by cannot find your columns mytemp2.way etc.


----------------------------------------------------------------------

Comment By: Stefan de Konink (skinkie)
Date: 2009-05-05 22:47

Message:
As you probably completely understand was the count(*) a debugging thing
for *. So my suggestion would be to add some heuristics for keyboard/chair
errors... "Hint: Cannot order on a single count(*)."

----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2009-05-05 21:23

Message:
AFAIR, the SQL standard required order by columns and/or expression to
occur in the projection list (select clause) of the query.
Basically, consider order by working on a subset of the projection list
(select clause) of the query.
A possible reason herefore is (IMHO) that otherwise (i.e., with not all
order by columns present in the result, implicit duplicate elimination
might drop tuples that have been used for sorting.
Then the error message is IMHO quite clear in your case: by the time order
by get's its turn, all columns are already projected away.

(Let alone that using order by in a query that is supposed to return a
single single-attribute tuple, i.e., a single value, does not seems to make
much sense, anyway ... ;-))


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2787448&group_id=56967

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to