-
Notifications
You must be signed in to change notification settings - Fork 31
Description
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:
duckdb-mysql/src/mysql_connection.cpp
Line 163 in 0971e91
| 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?