Bugs item #2831582, was opened at 2009-08-03 16:20 Message generated for change (Comment added) made by nielsnes You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2831582&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: SQL "stable" Status: Open >Resolution: Invalid Priority: 5 Private: No Submitted By: Wouter Alink (vzzzbx) Assigned to: Niels Nes (nielsnes) Summary: SQL: ambiguity not detected Initial Comment: The following query START TRANSACTION; CREATE TABLE b (value int); INSERT INTO b VALUES (25); SELECT (rel.value / 10) AS value, value as x FROM b as rel; ROLLBACK; Gives perhaps strange results: $ mclient -lsql -dtest1 temp.sql [ 1 ] % lhm., lhm.rel # table_name % value, x # name % int, int # type % 1, 2 # length [ 2, 25 ] Expected output would either be: [ 2, 2 ] Or an error which says that value is ambiguous. My mserver5 says: # MonetDB server v5.12.1, based on kernel v1.30.1 # Serving database 'test1', using 4 threads # Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked # Copyright (c) 1993-July 2008 CWI. # Copyright (c) August 2008-2009 MonetDB B.V., all rights reserved # Visit http://monetdb.cwi.nl/ for further information #warning: please don't forget to set your vault key! #(see /home/alink/opt/MonetDB-stable/etc/monetdb5.conf) # Listening for connection requests on mapi:monetdb://127.0.0.1:50100/ # MonetDB/SQL module v2.30.1 loaded ---------------------------------------------------------------------- >Comment By: Niels Nes (nielsnes) Date: 2009-08-16 09:14 Message: GROUP by works on the pre-selection result normaly, ie that the group by isn't using the extract etc is to be expected. The work around for your problem is an extra feature, ie we support fallback onto the selection when we cannot find column expressions in the pre-selection result. ---------------------------------------------------------------------- Comment By: Wouter Alink (vzzzbx) Date: 2009-08-10 15:29 Message: Apologies, I reduced the issue too much (I was already afraid to do so). The initial problem was: SELECT EXTRACT(YEAR FROM rel.value) as value FROM x as rel GROUP BY value; It was grouping on rel.value, and not on year (which I was expecting). The work-around was, using something like: SELECT EXTRACT(YEAR FROM rel.value) as avalue FROM x as rel GROUP BY avalue; Which worked like a charm. ---------------------------------------------------------------------- Comment By: Niels Nes (nielsnes) Date: 2009-08-10 15:12 Message: reopened on request from wouter ---------------------------------------------------------------------- Comment By: Niels Nes (nielsnes) Date: 2009-08-03 22:33 Message: selection doesn't look at aliases in the current selection list, it looks at column results from the inner query, ie in your example columns from 'rel'. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2831582&group_id=56967 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Monetdb-bugs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/monetdb-bugs
