Skip to content

Add support for sql_require_primary_key #28544

Closed

Description

@morgo

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

Activity

  1. 7yyo commented on Nov 11, 2021

    @7yyo
    Contributor

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

  2. morgo commented on Nov 11, 2021

    @morgo
    ContributorAuthor

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

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

  3. 7yyo commented on Nov 11, 2021

    @7yyo
    Contributor

    /assign

  4. morgo commented on Jul 8, 2022

    @morgo
    ContributorAuthor

    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.

  5. dveeden commented on Jul 12, 2022

    @dveeden
    Contributor

    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

Metadata

Metadata

Assignees

Labels

sig/sql-infraSIG: SQL Infratype/feature-requestCategorizes issue or PR as related to a new feature.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions