We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Repro:
PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "create table t (c1 int, c2 int, c3 int, unique key(c1,c2))" PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "insert into t(c1,c2,c3) values (0,0,0) on duplicate key update c3=0" Query OK, 1 row affected (0.00 sec) PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "insert into t(c1,c2,c3) values (0,0,0) on duplicate key update c3=0" Query OK, 0 rows affected (0.00 sec) PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "insert into t(c1,c2,c3) values (0,0,1) on duplicate key update c3=0" Query OK, 0 rows affected (0.00 sec) PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "select * from t" +----+----+----+ | c1 | c2 | c3 | +----+----+----+ | 0 | 0 | 1 | | 2 | 0 | 0 | | 0 | 0 | 0 | | 0 | 0 | 0 | +----+----+----+
The text was updated successfully, but these errors were encountered:
Related: #2289
Sorry, something went wrong.
Workaround is to make the unique key a primary key like so:
create table t (c1 int, c2 int, c3 int, primary key(c1,c2))
PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "create table p (c1 int, c2 int, c3 int, primary key(c1,c2))" PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "insert into p(c1,c2,c3) values (0,0,0) on duplicate key update c3=0" Query OK, 1 row affected (0.00 sec) PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "insert into p(c1,c2,c3) values (0,0,0) on duplicate key update c3=0" Query OK, 0 rows affected (0.00 sec) PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "insert into p(c1,c2,c3) values (0,0,0) on duplicate key update c3=1" Query OK, 2 rows affected (0.00 sec) PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "insert into p(c1,c2,c3) values (0,0,0) on duplicate key update c3=1" Query OK, 0 rows affected (0.01 sec) PS C:\Users\timse\dolthub\dolt\test_unique_key_on_duplicate> dolt sql -q "select * from p" +----+----+----+ | c1 | c2 | c3 | +----+----+----+ | 0 | 0 | 1 | +----+----+----+
Fixed in the above PR
insert ... on duplicate update ...
Issue should be resolved for GMS and dolt new format. Behavior for dolt old format is unchanged.
No branches or pull requests
Repro:
The text was updated successfully, but these errors were encountered: