Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql server default don't work at all due to broken regexp #483

Closed
sqlalchemy-bot opened this issue Feb 19, 2018 · 4 comments
Closed

mysql server default don't work at all due to broken regexp #483

sqlalchemy-bot opened this issue Feb 19, 2018 · 4 comments
Labels
autogenerate - detection bug Something isn't working
Milestone

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Michael Bayer (@zzzeek)

diff --git a/tests/test_mysql.py b/tests/test_mysql.py
index e7b1cf0..c7244a0 100644
--- a/tests/test_mysql.py
+++ b/tests/test_mysql.py
@@ -277,9 +277,10 @@ class MySQLDefaultCompareTest(TestBase):
         t1.create(self.bind)
         insp = Inspector.from_engine(self.bind)
         cols = insp.get_columns(t1.name)
+        refl = Table(t1.name, MetaData(), autoload_with=self.bind)
         ctx = self.autogen_context['context']
         return ctx.impl.compare_server_default(
-            None,
+            refl.c[cols[0]['name']],
             col,
             rendered,
             cols[0]['default'])
@@ -295,3 +296,23 @@ class MySQLDefaultCompareTest(TestBase):
             TIMESTAMP(),
             None, "CURRENT_TIMESTAMP",
         )
+
+    def test_compare_integer_same(self):
+        self._compare_default_roundtrip(
+            Integer(), "5"
+        )
+
+    def test_compare_integer_diff(self):
+        self._compare_default_roundtrip(
+            Integer(), "5", "7"
+        )
+
+    def test_compare_boolean_same(self):
+        self._compare_default_roundtrip(
+            Boolean(), "1"
+        )
+
+    def test_compare_boolean_diff(self):
+        self._compare_default_roundtrip(
+            Boolean(), "1", "0"
+        )
(END)

the regexp added in #455 is wrong due to missing r'' around the subsitution expression and breaks comparison of most values.

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

note also mariadb 10.2 reports integer defaults without quotes whereas other mysqls do.

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

Repair server default comparison for MySQL / MariaDB

The regexp for comparing the TIMESTAMP function
was obliterating all other comparisons as it was incorrect.
Add new regexp for integers that also adjusts for
mariadb 10.2 quoting differences vs. mariadb 10.1

Change-Id: I7bdaceb7e0dbe06bc2c3690cd5dd8e737716278c
Fixes: #455
Fixes: #483

c551955

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added autogenerate - detection bug Something isn't working labels Nov 27, 2018
@sqlalchemy-bot sqlalchemy-bot added this to the fasttrack milestone Nov 27, 2018
vvvrrooomm pushed a commit to vvvrrooomm/alembic that referenced this issue Jan 10, 2019
The regexp for comparing the TIMESTAMP function
was obliterating all other comparisons as it was incorrect.
Add new regexp for integers that also adjusts for
mariadb 10.2 quoting differences vs. mariadb 10.1

Change-Id: I7bdaceb7e0dbe06bc2c3690cd5dd8e737716278c
Fixes: sqlalchemy#455
Fixes: sqlalchemy#483
vvvrrooomm pushed a commit to vvvrrooomm/alembic that referenced this issue Jan 10, 2019
The regexp for comparing the TIMESTAMP function
was obliterating all other comparisons as it was incorrect.
Add new regexp for integers that also adjusts for
mariadb 10.2 quoting differences vs. mariadb 10.1

Change-Id: I7bdaceb7e0dbe06bc2c3690cd5dd8e737716278c
Fixes: sqlalchemy#455
Fixes: sqlalchemy#483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autogenerate - detection bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant