series as well. For changes that are specific to 1.0 with an emphasis
on compatibility concerns, see :doc:`/changelog/migration_10`.
+ .. change::
+ :tags: bug, mysql
+ :tickets: 3186
+
+ MySQL boolean symbols "true", "false" work again. 0.9's change
+ in :ticket:`2682` disallowed the MySQL dialect from making use of the
+ "true" and "false" symbols in the context of "IS" / "IS NOT", but
+ MySQL supports this syntax even though it has no boolean type.
+ MySQL remains "non native boolean", but the :func:`.true`
+ and :func:`.false` symbols again produce the
+ keywords "true" and "false", so that an expression like
+ ``column.is_(true())`` again works on MySQL.
+
+ .. seealso::
+
+ :ref:`bug_3186`
+
.. change::
:tags: changed, mssql
:tickets: 3182
:ticket:`2515`
+.. _bug_3186:
+
+MySQL boolean symbols "true", "false" work again
+------------------------------------------------
+
+0.9's overhaul of the IS/IS NOT operators as well as boolean types in
+:ticket:`2682` disallowed the MySQL dialect from making use of the
+"true" and "false" symbols in the context of "IS" / "IS NOT". Apparently,
+even though MySQL has no "boolean" type, it supports IS / IS NOT when the
+special "true" and "false" symbols are used, even though these are otherwise
+synonymous with "1" and "0" (and IS/IS NOT don't work with the numerics).
+
+So the change here is that the MySQL dialect remains "non native boolean",
+but the :func:`.true` and :func:`.false` symbols again produce the
+keywords "true" and "false", so that an expression like ``column.is_(true())``
+again works on MySQL.
+
+:ticket:`3186`
+
.. _change_3182:
PyODBC driver name is required with hostname-based SQL Server connections
value = value.replace('\\', '\\\\')
return value
+ # override native_boolean=False behavior here, as
+ # MySQL still supports native boolean
+ def visit_true(self, element, **kw):
+ return "true"
+
+ def visit_false(self, element, **kw):
+ return "false"
+
def get_select_precolumns(self, select):
"""Add special MySQL keywords in place of DISTINCT.
name = 'mysql'
supports_alter = True
+ # MySQL has no true "boolean" type; we
+ # allow for the "true" and "false" keywords, however
+ supports_native_boolean = False
+
# identifiers are 64, however aliases can be 255...
max_identifier_length = 255
max_index_name_length = 64
# coding: utf-8
-from sqlalchemy.testing import eq_
+from sqlalchemy.testing import eq_, is_
from sqlalchemy import *
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import testing
+class IdiosyncrasyTest(fixtures.TestBase, AssertsCompiledSQL):
+ __only_on__ = 'mysql'
+ __backend__ = True
+
+ def test_is_boolean_symbols_despite_no_native(self):
+ is_(
+ testing.db.scalar(select([cast(true().is_(true()), Boolean)])),
+ True
+ )
+
+ is_(
+ testing.db.scalar(select([cast(true().isnot(true()), Boolean)])),
+ False
+ )
+
+ is_(
+ testing.db.scalar(select([cast(false().is_(false()), Boolean)])),
+ True
+ )
+
+
class MatchTest(fixtures.TestBase, AssertsCompiledSQL):
__only_on__ = 'mysql'
__backend__ = True