Hi!
On 26.01.2009 20:47 Uhr, Francesco Riosa wrote:
plain simple, could an additional comma to the end of a group avoid a syntax
error?
example:
SELECT * FROM t1 WHERE c1 IN ("alpha", "beta", "gamma", )
also:
SELECT alfa, beta, gamma, FROM t1 LIMIT 1
Some programming languages (python) already work this way,
very handy, try to belive.
apart from potentially introducing all kinds of "interesting" lookahead
issues in the grammar, this would also mask genuine errors *very* easily.
Usually this happens when IN-lists are generated by code, and usually
there's a NULL (or nil or null or whatever it is in the language you are
using) lurking somewhere. In all cases I've seen in my life this is code
smell, if not an outright bug in the application code.
Along the same lines people will start arguing that SELECT * from T
WHERE c IN (1,2,,3,) should be allowed, because it's "clear what i
meant". Except it isn't, at least not in its full generality.
I'm strongly of the opinion that this is and should remain a syntax
error. Now, if you would argue that the error message for this is less
than helpful, I'd whole-heartedly agree :)
cheers,
-k
As an aside: Wasn't there some construct in Python that even requires a
trailing comma? (Not that I know for sure...)
--
Kay Roepke
Software Engineer, MySQL Enterprise Tools
Sun Microsystems GmbH Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Dr. Roland Boemer
Vorsitz d. Aufs.rat.: Martin Haering HRB MUC 161028
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp