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 support for sql_require_primary_key #28544

Closed
morgo opened this issue Oct 3, 2021 · 5 comments · Fixed by #36146
Closed

Add support for sql_require_primary_key #28544

morgo opened this issue Oct 3, 2021 · 5 comments · Fixed by #36146
Assignees
Labels
sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@morgo
Copy link
Contributor

morgo commented Oct 3, 2021

Feature Request

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

Describe the feature you'd like:

This is a feature from MySQL 8.0:
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key

It allows you to enforce tables have a primary key. It has more meaning in MySQL because row-based replication benefits from it (Edit that: it very much applies to TiCDC), and InnoDB is less efficient when using its internal primary key. But it's still useful.

Describe alternatives you've considered:

N/A - compatibility feature.

Teachability, Documentation, Adoption, Migration Strategy:

Compatibility feature

@morgo morgo added sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature. labels Oct 3, 2021
@morgo morgo mentioned this issue Oct 3, 2021
70 tasks
@7yyo
Copy link
Contributor

7yyo commented Nov 11, 2021

hello @morgo I want to try to add this feature.

@morgo
Copy link
Contributor Author

morgo commented Nov 11, 2021

hello @morgo I want to try to add this feature.

Glad to hear! Please feel free to /assign it to yourself.

@7yyo
Copy link
Contributor

7yyo commented Nov 11, 2021

/assign

@morgo
Copy link
Contributor Author

morgo commented Jul 8, 2022

I discovered that TiCDC does not replicate tables without a primary key by default (although there is now an option for it). So this feature request actually has a lot of usage in TiDB to ensure CDC replication.

@dveeden
Copy link
Contributor

dveeden commented Jul 12, 2022

Note that MySQL now is getting another related feature that helps with this: Generated Invisible Primary Keys. It seems that this is already in the docs, but the version of MySQL that contains this (8.0.30) is not yet released.

This may also benefit TiCDC etc if we would implement it in TiDB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra 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.

3 participants