Good point. Ok.. I'm convinced. -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of James K. Lowden Sent: Thursday, August 15, 2013 12:27 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] name resolutionn in GROUP BY
On Wed, 14 Aug 2013 14:57:19 -0500 "Marc L. Allen" <mlal...@outsitenetworks.com> wrote: > I'd actually like a compromise. Allow GROUP BY to accept a derived > name if no base name exists. I realize that's against spec, but > there's no ambiguity (as it otherwise errors out), It would also mean the query's meaning could change if the underlying DDL changed. If the column were later added (say, to a view) that happened to have the same name as that of the alias in the query, the DML would silently start using the "base" name instead of the derived one. That's not normally the case in SQL. Normally, adding a column to a table/view cannot change the query's meaning. Either the query is unaffected, or the new column introduces ambiguity (in the presence of a join) that causes it to return an error. The only safe and proper thing is for GROUP BY to refer to the column names as known to the database, not to aliases mentioned in the query. > and does make it much nicer when the derived column is a hairy > expression that I end up needing to replicate in the GROUP BY clause. We do need a better language, yes. --jkl _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users This email and any attachments are only for use by the intended recipient(s) and may contain legally privileged, confidential, proprietary or otherwise private information. Any unauthorized use, reproduction, dissemination, distribution or other disclosure of the contents of this e-mail or its attachments is strictly prohibited. If you have received this email in error, please notify the sender immediately and delete the original. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users