Hi

On 12/09/2008, at 7:15 PM, [EMAIL PROTECTED] wrote:

I'm a little confused (and fairly new to the list), so please forgive me if
I've got the wrong end of the stick...

So the SQL standard states that NOT has high precedence so
     NOT a BETWEEN b AND c
evaluates to
     (NOT a) BETWEEN b AND c
(does anyone have a link to the SQL standard?)

No, the other way round.


But according to the MySQL docs:

From MySQL 5.0.2 on, the precedence of the NOT operator is such that
expressions such as NOT a BETWEEN b AND c  are parsed as
NOT (a BETWEEN b AND c). Before MySQL 5.0.2, the expression is parsed as (NOT a) BETWEEN b AND c. The old higher-precedence behavior can be obtained
by enabling the HIGH_NOT_PRECEDENCE SQL mode.

So as of MySQL 5.0.2, the default syntax deviates from the standard? Or am
mistaken?

You're mistaken, since 5.0.2 does the same as other brands, and follows the SQL-99/2003 standard for this.


If we implement the SQL standard behaviour in Drizzle, there is no
workaround to enable the old behaviour.

Wouldn't the workaround be to add parens around the between?
     NOT (a BETWEEN b AND c)

This is the default of MySQL without the sql_mode (as the docs explain), and should also be what Drizzle does.

Or use the more natural syntax of
     a NOT BETWEEN b AND c

That would change SQL syntax, not a good idea.

As the whole effort behind Drizzle seems to be about doing things right
(I'll be glad to see the back of multiple character encodings), then I
would vote to go with the standard whenever possible.

Yup.
So we need to ditch the sql_mode option, but make sure that Drizzle does the same as MySQL by default, which is correct.
If Drizzle has been doing something different, that needs to be fixed.


(btw, please do shorten your mintel email footer, it's ridiculously long ;-)


Cheers,
Arjen.
--
Arjen Lentz, Founder @ Open Query
Training and Expertise for MySQL in Australia and New Zealand
http://openquery.com.au/training/  (ph. +61-7-3103 0809)






_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to