Skip to content

Insert/Update Operations Fail Due to Missing Index Information Retrieval in MySQL Table #176

@ay27

Description

@ay27

I encountered an issue where attaching a MySQL instance works normally, and all read queries execute correctly. However, any insert or update operations consistently result in the following error:

_duckdb.BinderException: Binder Error: There are no UNIQUE/PRIMARY KEY constraints that refer to this table, specify ON CONFLICT columns manually

Following the guidance, I attempted to include an ON CONFLICT statement, for example:
INSERT INTO mysql.xxx ... ON CONFLICT (id) DO NOTHING;
This, in turn, triggers another error:
_duckdb.BinderException: Binder Error: The specified columns as conflict target are not referenced by a UNIQUE/PRIMARY KEY CONSTRAINT or INDEX

Upon further investigation, I noticed that in the code, when retrieving MySQL index information, the plugin currently returns an empty list by default:

vector<IndexInfo> MySQLConnection::GetIndexInfo(const string &table_name) {

I would like to inquire: Is this behavior an intentional design choice, or is there a specific reason for implementing it this way?
If this function were fixed to correctly return the index information for the table, would it allow insert/update operations to proceed normally?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions