Skip to content

Conversation

akirk
Copy link
Member

@akirk akirk commented Jul 18, 2024

In a table like

CREATE TABLE `test` (
	`id` INT,
	`name` VARCHAR(255),
	`other` VARCHAR(255),
	PRIMARY KEY (id),
	UNIQUE KEY (name)
)

the internal name for the unique key would be ( because typically a key would be defined with

UNIQUE KEY `name` (name)

Usually this wrong key name is not a problem unless a INSERT .. ON DUPLICATE KEY statement is used where the resulting ON CONFLICT( "keyname" ) would be transformed to ON CONFLICT( "" ) which then fails.

To fix this, this now derives a key name in case it is omitted..

cc @costasovo

Copy link
Member

@brandonpayton brandonpayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, and the updated tests pass. Thanks, @akirk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants