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

support mysql DROP for CHECK constraints, which might be different from that of mariadb #554

Closed
hahahannes opened this issue Apr 30, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@hahahannes
Copy link

commented Apr 30, 2019

With version 8.0.16 mysql fully supports constraints. But I noticed that drop_constraint is not working because it produces ALTER TABLE DROP CONSTRAINT and not ALTER TABLE DROP CHECK which mysql uses

@zzzeek

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

hi -

MariaDB added real check contraints first, and we support those with "ALTER TABLE DROP CONSTRAINT " which is what MariaDB allows. At the time, there was no "DROP CHECK".
Can you refer me to the MySQL documentation illustrating the syntax they'd like to use, and can you confirm that they are not accepting MariaDB's syntax ?

@zzzeek zzzeek added this to the fasttrack milestone Apr 30, 2019

@zzzeek zzzeek added the bug label Apr 30, 2019

@zzzeek zzzeek changed the title drop_constraint not compatible with mysql 8.0.16 support mysql DROP for CHECK constraints, which might be different from that of mariadb Apr 30, 2019

@zzzeek

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

we would need to run "DROP CHECK" syntax against mariadb also to see if they support it, however I have a feeling that at least some MariaDB versions that support CHECK constraints might not support "DROP CHECK" syntax. Basically we need a syntax table.

@hahahannes

This comment has been minimized.

Copy link
Author

commented Apr 30, 2019

thanks for the fast response. The link to the documentation https://dev.mysql.com/doc/refman/8.0/en/create-table-check-constraints.html.

Yes, I can confirm.
To reproduce with version 8.0.16:

CREATE TABLE test (id VARCHAR(50), CONSTRAINT test_constraint CHECK (id IS NOT NULL));
ALTER TABLE test DROP CONSTRAINT test_constraint; -> syntax error
ALTER TABLE test DROP CHECK test_constraint; -> working
@sqla-tester

This comment has been minimized.

Copy link
Collaborator

commented Apr 30, 2019

Mike Bayer has proposed a fix for this issue in the master branch:

Emit DROP CHECK for MySQL, DROP CONSTRAINT for MariaDB https://gerrit.sqlalchemy.org/1245

@zzzeek

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

yup thanks, i have an approach in review. it just might be difficult for the --sql use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.