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

Add CHECK_CONSTRAINTS table for mysql8 compatibility #46427

Closed
Mini256 opened this issue Aug 25, 2023 · 1 comment · Fixed by #46428
Closed

Add CHECK_CONSTRAINTS table for mysql8 compatibility #46427

Mini256 opened this issue Aug 25, 2023 · 1 comment · Fixed by #46428
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) type/compatibility type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@Mini256
Copy link
Member

Mini256 commented Aug 25, 2023

Feature Request

Is your feature request related to a problem? Please describe:

After PR #46155 merged into master, the change in MySQL version number caused the Prisma's integration tests continuously report errors.

The failure reason is because Prisma found that CHECK_CONSTRAINTS table does not exist. I guess because Prisma decides whether to read the table based on the version number of mysql.

e8025d8b-c7ad-481d-a590-28058aeae92d

Describe the feature you'd like:

Add the CHECK_CONSTRAINTS meta-information table before a new version is released, otherwise this will prevent Prisma users from using the latest version of TiDB properly:

https://dev.mysql.com/doc/mysql-infoschema-excerpt/8.0/en/information-schema-check-constraints-table.html

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

@Mini256 Mini256 added the type/feature-request Categorizes issue or PR as related to a new feature. label Aug 25, 2023
@dveeden
Copy link
Contributor

dveeden commented Aug 25, 2023

MySQL

sql> CREATE TABLE t1 (id int primary key, check (id>10));
Query OK, 0 rows affected (0.0739 sec)

sql> DESCRIBE information_schema.CHECK_CONSTRAINTS;
+--------------------+-------------+------+-----+---------+-------+
| Field              | Type        | Null | Key | Default | Extra |
+--------------------+-------------+------+-----+---------+-------+
| CONSTRAINT_CATALOG | varchar(64) | NO   |     | NULL    |       |
| CONSTRAINT_SCHEMA  | varchar(64) | NO   |     | NULL    |       |
| CONSTRAINT_NAME    | varchar(64) | NO   |     | NULL    |       |
| CHECK_CLAUSE       | longtext    | NO   |     | NULL    |       |
+--------------------+-------------+------+-----+---------+-------+
4 rows in set (0.0033 sec)

sql> TABLE information_schema.CHECK_CONSTRAINTS;
+--------------------+-------------------+-----------------+--------------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME | CHECK_CLAUSE |
+--------------------+-------------------+-----------------+--------------+
| def                | test              | t1_chk_1        | (`id` > 10)  |
+--------------------+-------------------+-----------------+--------------+
1 row in set (0.0017 sec)

sql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.1.0     |
+-----------+
1 row in set (0.0006 sec)

TiDB

sql> SET GLOBAL tidb_enable_check_constraint=ON;
Query OK, 0 rows affected (0.0459 sec)

sql> CREATE TABLE t1 (id int primary key, check (id>10));
Query OK, 0 rows affected (0.2051 sec)

sql> DESCRIBE information_schema.CHECK_CONSTRAINTS;
ERROR: 1146 (42S02): Table 'information_schema.CHECK_CONSTRAINTS' doesn't exist

sql> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v7.3.0
Edition: Community
Git Commit Hash: 40b72e7a9a4fc9670d4c5d974dd503a3c6097471
Git Branch: heads/refs/tags/v7.3.0
UTC Build Time: 2023-08-08 10:08:14
GoVersion: go1.20.7
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.0011 sec)

@dveeden dveeden added type/compatibility compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) type/compatibility type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants