Skip to content

Commit

Permalink
sql: update unique violation error to be Postgres compatible
Browse files Browse the repository at this point in the history
This commit fixes the violation error for unique constraints to match
the message used by Postres. Previously, the error would have been
printed as:

duplicate key value (k)=(1) violates unique constraint "primary"

Now this message is printed as:

duplicate key value violates unique constraint "primary"
DETAIL: Key (k)=(1) already exists\.

Release note (sql change): The error message for unique constraint
violations now matches the error used by Postgres. For example,
the new error message looks like this:
ERROR:  duplicate key value violates unique constraint "primary"
DETAIL: Key (k)=(1) already exists.
  • Loading branch information
rytaft committed Dec 21, 2020
1 parent 01b34eb commit 868411c
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 56 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/alter_table
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ ALTER TABLE t ADD d INT UNIQUE
statement ok
INSERT INTO t VALUES (4, 9, 1)

statement error duplicate key value \(d\)=\(1\) violates unique constraint \"t_d_key\"
statement error duplicate key value violates unique constraint \"t_d_key\"\nDETAIL: Key \(d\)=\(1\) already exists\.
INSERT INTO t VALUES (5, 9, 1)

# Add a column with no default value
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/array
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ INSERT INTO t VALUES

# Test that the unique index rejects bad inserts.
# Disabled until #50659 is resolved.
#statement error pq: duplicate key value \(x\)=\(ARRAY\[1,NULL,10\]\) violates unique constraint "primary"
#statement error pq: duplicate key value violates unique constraint "primary"\nDETAIL: Key \(x\)=\(ARRAY\[1,NULL,10\]\) already exists\.
#INSERT INTO t VALUES (ARRAY[1, NULL, 10])

query T
Expand Down
6 changes: 3 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/cascade
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ SELECT * FROM b;
1 2 3 4 5 1006 7 8 9 10

# Also ensure that normal errors are still correctly wrapped even if cascading.
statement error pq: duplicate key value \(id\)=\(1\) violates unique constraint "primary"
statement error pq: duplicate key value violates unique constraint "primary"\nDETAIL: Key \(id\)=\(1\) already exists\.
UPDATE a SET id = 1 WHERE id = 1006;

# 7. ON DELETE SET NULL
Expand Down Expand Up @@ -3293,7 +3293,7 @@ statement oK
INSERT INTO a VALUES ('original'), ('default');
INSERT INTO b VALUES ('b1', 'original'), ('b2', 'default');

statement error pq: duplicate key value \(a_id\)=\('default'\) violates unique constraint "b_a_id_key"
statement error pq: duplicate key value violates unique constraint "b_a_id_key"\nDETAIL: Key \(a_id\)=\('default'\) already exists\.
DELETE FROM a WHERE id = 'original';

# Clean up after the test.
Expand Down Expand Up @@ -3676,7 +3676,7 @@ statement oK
INSERT INTO a VALUES ('original'), ('default');
INSERT INTO b VALUES ('b1', 'original'), ('b2', 'default');

statement error pq: duplicate key value \(a_id\)=\('default'\) violates unique constraint "b_a_id_key"
statement error pq: duplicate key value violates unique constraint "b_a_id_key"\nDETAIL: Key \(a_id\)=\('default'\) already exists\.
UPDATE a SET id = 'updated' WHERE id = 'original';

# Clean up after the test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CREATE TABLE p (
statement ok
INSERT INTO p VALUES ('a' COLLATE en_u_ks_level1)

statement error duplicate key value \(a\)=\('a' COLLATE en_u_ks_level1\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(a\)=\('a' COLLATE en_u_ks_level1\) already exists\.
INSERT INTO p VALUES ('A' COLLATE en_u_ks_level1)

statement ok
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/datetime
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SELECT * FROM t WHERE a = '2015-08-25 04:45:45.53453+01:00'::timestamp
2015-08-25 04:45:45.53453 +0000 +0000 2015-08-25 00:00:00 +0000 +0000 02:45:02.234

# insert duplicate value with different time zone offset
statement error duplicate key value \(a\)=\('2015-08-30 03:34:45\.34567'\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(a\)=\('2015-08-30 03:34:45\.34567'\) already exists\.
INSERT INTO t VALUES
('2015-08-30 03:34:45.34567-07:00', '2015-08-31', '35h2s')

Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/fk
Original file line number Diff line number Diff line change
Expand Up @@ -2824,7 +2824,7 @@ INSERT INTO child (c, p) VALUES (200, 2)

# These two test cases are sort of undefined behavior, since their
# success/failure depends on the order in which the updates are performed.
statement error duplicate key value \(p\)=\(3\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(p\)=\(3\) already exists\.
UPDATE parent SET p = p + 1

statement ok
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/hash_sharded_index
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sharded_primary CREATE TABLE public.sharded_primary (
statement ok
INSERT INTO sharded_primary values (1), (2), (3)

query error pq: duplicate key value \(crdb_internal_a_shard_10,a\)=\(6,1\) violates unique constraint "primary"
query error pq: duplicate key value violates unique constraint "primary"\nDETAIL: Key \(crdb_internal_a_shard_10,a\)=\(6,1\) already exists\.
INSERT INTO sharded_primary values (1)

# Ensure that the shard column is assigned into the column family of the first column in
Expand Down
8 changes: 4 additions & 4 deletions pkg/sql/logictest/testdata/logic_test/insert
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ SELECT v || 'hello' FROM [INSERT INTO kv VALUES ('e', 'f'), ('g', '') RETURNING
fhello
hello

statement error pgcode 23505 duplicate key value \(v\)=\('f'\) violates unique constraint "a"
statement error pgcode 23505 duplicate key value violates unique constraint "a"\nDETAIL: Key \(v\)=\('f'\) already exists\.
INSERT INTO kv VALUES ('h', 'f')

statement ok
INSERT INTO kv VALUES ('f', 'g')

statement error duplicate key value \(v\)=\('g'\) violates unique constraint "a"
statement error duplicate key value violates unique constraint "a"\nDETAIL: Key \(v\)=\('g'\) already exists\.
INSERT INTO kv VALUES ('h', 'g')

query TT
Expand Down Expand Up @@ -330,7 +330,7 @@ INSERT INTO abc VALUES (1, 2, 10)

# Verify we get the correct message, even though internally the ConditionalPut
# for the index key will also fail.
statement error pgcode 23505 duplicate key value \(a,b\)=\(1,2\) violates unique constraint "primary"
statement error pgcode 23505 duplicate key value violates unique constraint "primary"\nDETAIL: Key \(a,b\)=\(1,2\) already exists\.
INSERT INTO abc VALUES (1, 2, 20)

statement ok
Expand All @@ -352,7 +352,7 @@ CREATE TABLE blindcput (

# The optimization thresholds at 10 k/v operations, so we need at least that
# many in one batch to trigger it.
statement error duplicate key value \(x\)=\(1\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(x\)=\(1\) already exists\.
INSERT INTO blindcput values (1, 1), (2, 2), (3, 3), (4, 4), (1, 5)

statement ok
Expand Down
6 changes: 3 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/interleaved
Original file line number Diff line number Diff line change
Expand Up @@ -369,17 +369,17 @@ INSERT INTO p20067 VALUES (1, 'John Doe');
INSERT INTO c20067 VALUES (1, 1, 'John Doe Junior');
COMMIT;

statement error duplicate key value \(name\)=\('John Doe Junior'\) violates unique constraint "uq_name"
statement error duplicate key value violates unique constraint "uq_name"\nDETAIL: Key \(name\)=\('John Doe Junior'\) already exists\.
INSERT INTO c20067 VALUES (2, 1, 'John Doe Junior')

statement error duplicate key value \(name\)=\('John Doe Junior'\) violates unique constraint "uq_name"
statement error duplicate key value violates unique constraint "uq_name"\nDETAIL: Key \(name\)=\('John Doe Junior'\) already exists\.
BEGIN; INSERT INTO p20067 VALUES (2, 'John Doe'); INSERT INTO c20067 VALUES (2, 1, 'John Doe Junior'); END;

# End the last transaction.
statement ok
END

statement error duplicate key value \(p_id,c_id\)=\(1,1\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(p_id,c_id\)=\(1,1\) already exists\.
INSERT INTO c20067 VALUES (1, 1, 'John Doe')

# Regression test for #26756: ensure that interleaved table joins don't get
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/materialized_view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ CREATE MATERIALIZED VIEW v_dup AS SELECT x FROM dup;
CREATE UNIQUE INDEX i ON v_dup (x);
INSERT INTO dup VALUES (1), (1);

statement error pq: duplicate key value \(x\)=\(1\) violates unique constraint "i"
statement error pq: duplicate key value violates unique constraint "i"\nDETAIL: Key \(x\)=\(1\) already exists\.
REFRESH MATERIALIZED VIEW v_dup

# We shouldn't be able to mix materialized and non materialized views in DDLs.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/logictest/testdata/logic_test/multi_statement
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ c d

# error if either statement returns an error
# first statement returns an error. Second stmt shouldn't execute.
statement error duplicate key value \(k\)=\('a'\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\('a'\) already exists\.
INSERT INTO kv (k,v) VALUES ('a', 'b'); INSERT INTO kv (k,v) VALUES ('e', 'f')

query TT rowsort
Expand All @@ -29,7 +29,7 @@ a b
c d

# second statement returns an error
statement error duplicate key value \(k\)=\('a'\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\('a'\) already exists\.
INSERT INTO kv (k,v) VALUES ('g', 'h'); INSERT INTO kv (k,v) VALUES ('a', 'b')

query TT rowsort
Expand Down
12 changes: 6 additions & 6 deletions pkg/sql/logictest/testdata/logic_test/parallel_stmts_compat
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CREATE TABLE fk(
statement ok
INSERT INTO kv VALUES (1, 2) RETURNING NOTHING

statement error duplicate key value \(k\)=\(1\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\(1\) already exists\.
INSERT INTO kv VALUES (1, 2) RETURNING NOTHING

statement ok
Expand All @@ -33,7 +33,7 @@ UPSERT INTO kv VALUES (2, 500) RETURNING NOTHING
statement ok
UPDATE kv SET v = k WHERE k = 3 RETURNING NOTHING

statement error duplicate key value \(k\)=\(1\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\(1\) already exists\.
UPDATE kv SET k = 1 WHERE k = 2 RETURNING NOTHING

statement ok
Expand Down Expand Up @@ -84,7 +84,7 @@ BEGIN
statement ok
INSERT INTO kv VALUES (4, 5) RETURNING NOTHING

statement error duplicate key value \(k\)=\(2\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\(2\) already exists\.
INSERT INTO kv VALUES (2, 3) RETURNING NOTHING

statement error current transaction is aborted, commands ignored until end of transaction block
Expand Down Expand Up @@ -190,7 +190,7 @@ BEGIN
statement ok
UPDATE kv SET k = 9 WHERE k = 1 RETURNING NOTHING

statement error duplicate key value \(k\)=\(3\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\(3\) already exists\.
UPDATE kv SET k = 3 WHERE k = 2 RETURNING NOTHING

statement error current transaction is aborted, commands ignored until end of transaction block
Expand Down Expand Up @@ -316,7 +316,7 @@ SELECT k, v FROM kv ORDER BY k
statement ok
BEGIN

statement error duplicate key value \(k\)=\(1\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\(1\) already exists\.
INSERT INTO kv VALUES (1, 2) RETURNING NOTHING

statement error current transaction is aborted, commands ignored until end of transaction block
Expand Down Expand Up @@ -361,7 +361,7 @@ BEGIN
statement ok
EXECUTE x(1, 2)

statement error duplicate key value \(k\)=\(1\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\(1\) already exists\.
EXECUTE x(1, 2)

statement ok
Expand Down
12 changes: 6 additions & 6 deletions pkg/sql/logictest/testdata/logic_test/partial_index
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,15 @@ CREATE TABLE u (
)

# Inserting multiple rows that conflicts fails.
statement error pgcode 23505 duplicate key value \(a\)=\(1\) violates unique constraint \"i\"
statement error pgcode 23505 duplicate key value violates unique constraint \"i\"\nDETAIL: Key \(a\)=\(1\) already exists\.
INSERT INTO u VALUES (1, 1), (1, 2)

# Inserting multiple rows that don't conflict succeeds.
statement ok
INSERT INTO u VALUES (1, 1), (2, 2), (1, -1)

# Inserting a row that conflicts with an existing row fails.
statement error pgcode 23505 duplicate key value \(a\)=\(1\) violates unique constraint \"i\"
statement error pgcode 23505 duplicate key value violates unique constraint \"i\"\nDETAIL: Key \(a\)=\(1\) already exists\.
INSERT INTO u VALUES (1, 3)

query II rowsort
Expand All @@ -684,12 +684,12 @@ DELETE FROM u WHERE a = 2;
INSERT INTO u VALUES (2, 2);

# Updating a row in the unique partial index to conflict with another row fails.
statement error pgcode 23505 duplicate key value \(a\)=\(2\) violates unique constraint \"i\"
statement error pgcode 23505 duplicate key value violates unique constraint \"i\"\nDETAIL: Key \(a\)=\(2\) already exists\.
UPDATE u SET a = 2 WHERE b = 1

# Updating a row not in the unique partial index to conflict with a row in the
# index fails.
statement error pgcode 23505 duplicate key value \(a\)=\(2\) violates unique constraint \"i\"
statement error pgcode 23505 duplicate key value violates unique constraint \"i\"\nDETAIL: Key \(a\)=\(2\) already exists\.
UPDATE u SET a = 2, b = 1 WHERE b = -1

# Updating a row not in the unique index to remain out of the unique index
Expand Down Expand Up @@ -885,7 +885,7 @@ statement ok
CREATE UNIQUE INDEX i2 ON u (a) WHERE b < 0;
INSERT INTO u VALUES (-1, -1);

statement error pgcode 23505 duplicate key value \(a\)=\(-1\) violates unique constraint \"i2\"
statement error pgcode 23505 duplicate key value violates unique constraint \"i2\"\nDETAIL: Key \(a\)=\(-1\) already exists\.
INSERT INTO u VALUES (-1, -1) ON CONFLICT (a) WHERE b > 0 DO NOTHING

# Two arbiters can be used to detect conflicts and avoid duplicate key errors.
Expand Down Expand Up @@ -1005,7 +1005,7 @@ CREATE UNIQUE INDEX i2 ON u (a) WHERE b < 0;

# There can be duplicate key errors from unique partial indexes that are not
# arbiters.
statement error pgcode 23505 duplicate key value \(a\)=\(1\) violates unique constraint \"i2\"
statement error pgcode 23505 duplicate key value violates unique constraint \"i2\"\nDETAIL: Key \(a\)=\(1\) already exists\.
INSERT INTO u VALUES (1, -1) ON CONFLICT (a) WHERE b > 0 DO UPDATE SET a = 100

statement ok
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/txn
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ a c
statement ok
BEGIN

statement error duplicate key value \(k\)=\('a'\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\('a'\) already exists\.
INSERT INTO kv VALUES('unique_key', 'some value');
INSERT INTO kv VALUES('a', 'c');
INSERT INTO kv VALUES('unique_key2', 'some value');
Expand Down
8 changes: 4 additions & 4 deletions pkg/sql/logictest/testdata/logic_test/update
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ c d
e f
f g

statement error duplicate key value \(v\)=\('g'\) violates unique constraint "a"
statement error duplicate key value violates unique constraint "a"\nDETAIL: Key \(v\)=\('g'\) already exists\.
UPDATE kv2 SET v = 'g' WHERE k IN ('a')

statement count 1
Expand Down Expand Up @@ -255,10 +255,10 @@ SELECT * FROM abc
statement count 1
INSERT INTO abc VALUES (4, 5, 6)

statement error duplicate key value \(a\)=\(4\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(a\)=\(4\) already exists\.
UPDATE abc SET a = 4, b = 3

statement error duplicate key value \(c\)=\(6\) violates unique constraint "d"
statement error duplicate key value violates unique constraint "d"\nDETAIL: Key \(c\)=\(6\) already exists\.
UPDATE abc SET a = 2, c = 6

query III
Expand Down Expand Up @@ -347,7 +347,7 @@ CREATE TABLE pks (
statement count 2
INSERT INTO pks VALUES (1, 2, 3), (4, 5, 3)

statement error duplicate key value \(k2,v\)=\(5,3\) violates unique constraint "i"
statement error duplicate key value violates unique constraint "i"\nDETAIL: Key \(k2,v\)=\(5,3\) already exists\.
UPDATE pks SET k2 = 5 where k1 = 1

# Test updating only one of the columns of a multi-column primary key.
Expand Down
6 changes: 3 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/upsert
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ INSERT INTO kv VALUES (4, 10) ON CONFLICT (k) DO UPDATE SET v = v + 1
statement count 1
INSERT INTO kv VALUES (4, 10) ON CONFLICT (k) DO UPDATE SET v = kv.v + 20

statement error duplicate key value \(k\)=\(3\) violates unique constraint "primary"
statement error duplicate key value violates unique constraint "primary"\nDETAIL: Key \(k\)=\(3\) already exists\.
INSERT INTO kv VALUES (2, 10) ON CONFLICT (k) DO UPDATE SET k = 3, v = 10

statement count 1
Expand Down Expand Up @@ -1030,7 +1030,7 @@ statement error pq: UPSERT or INSERT...ON CONFLICT command cannot affect row a s
INSERT INTO tdup VALUES (1, 2, 1), (1, 3, 1) ON CONFLICT (x) DO UPDATE SET z=1

# Verify that duplicate insert into secondary fails with regular conflict error.
statement error pq: duplicate key value \(y\)=\(2\) violates unique constraint "tdup_y_key"
statement error pq: duplicate key value violates unique constraint "tdup_y_key"\nDETAIL: Key \(y\)=\(2\) already exists\.
INSERT INTO tdup VALUES (2, 2, 2), (3, 2, 2) ON CONFLICT (x) DO UPDATE SET z=1

statement ok
Expand Down Expand Up @@ -1073,7 +1073,7 @@ SELECT * FROM tdup@tdup_y_z_key
3 2 NULL

# Verify that duplicate secondary key fails with regular conflict error.
statement error pq: duplicate key value \(y,z\)=\(1,2\) violates unique constraint "tdup_y_z_key"
statement error pq: duplicate key value violates unique constraint "tdup_y_z_key"\nDETAIL: Key \(y,z\)=\(1,2\) already exists\.
INSERT INTO tdup VALUES (6, 1, 1), (7, 1, 2) ON CONFLICT (y, z) DO UPDATE SET z=2

# With constant grouping columns (no error).
Expand Down
6 changes: 3 additions & 3 deletions pkg/sql/mutation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ INSERT INTO d.a(a) VALUES (1);
for i, step := range []func() (*gosql.Rows, error){step1, step2} {
rows, err := step()
if err != nil {
if !testutils.IsError(err, `duplicate key value \(a\)=\(1\)`) {
if !testutils.IsError(err, `duplicate key value`) {
t.Errorf("%d: %v", i, err)
}
} else {
Expand All @@ -68,7 +68,7 @@ INSERT INTO d.a(a) VALUES (1);
err := rows.Scan(&val)

if err != nil {
if !testutils.IsError(err, `duplicate key value \(a\)=\(1\)`) {
if !testutils.IsError(err, `duplicate key value`) {
t.Errorf("%d: %v", i, err)
}
} else {
Expand All @@ -80,7 +80,7 @@ INSERT INTO d.a(a) VALUES (1);
for rows.Next() {
err := rows.Scan(&val)
if err != nil {
if !testutils.IsError(err, `duplicate key value \(a\)=\(1\)`) {
if !testutils.IsError(err, `duplicate key value`) {
t.Errorf("%d: %v", i, err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/opt/exec/execbuilder/testdata/insert
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ output row: ['a' 'b']
output row: ['c' 'd']
output row: ['e' 'f']

statement error pgcode 23505 duplicate key value \(v\)=\('f'\) violates unique constraint "a"
statement error pgcode 23505 duplicate key value violates unique constraint "a"\nDETAIL: Key \(v\)=\('f'\) already exists\.
INSERT INTO kv VALUES ('h', 'f')

statement ok
Expand Down Expand Up @@ -208,7 +208,7 @@ output row: ['c' 'd']
output row: ['e' 'f']
output row: ['f' 'g']

statement error duplicate key value \(v\)=\('g'\) violates unique constraint "a"
statement error duplicate key value violates unique constraint "a"\nDETAIL: Key \(v\)=\('g'\) already exists\.
INSERT INTO kv VALUES ('h', 'g')

statement ok
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/opt/exec/execbuilder/testdata/show_trace
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION]
flow CPut /Table/54/1/1/0 -> /TUPLE/2:2:Int/2
flow InitPut /Table/54/2/2/0 -> /BYTES/0x89
kv.DistSender: sending partial batch r28: sending batch 1 CPut, 1 EndTxn to (n1,s1):1
exec stmt execution failed after 0 rows: duplicate key value (k)=(1) violates unique constraint "primary"
exec stmt execution failed after 0 rows: duplicate key value violates unique constraint "primary"\nDETAIL: Key (k)=(1) already exists\.

statement error duplicate key value
SET tracing = on,kv,results; INSERT INTO t.kv(k, v) VALUES (2,2); SET tracing = off
Expand All @@ -108,7 +108,7 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION]
flow CPut /Table/54/1/2/0 -> /TUPLE/2:2:Int/2
flow InitPut /Table/54/2/2/0 -> /BYTES/0x8a
kv.DistSender: sending partial batch r28: sending batch 1 CPut, 1 EndTxn to (n1,s1):1
exec stmt execution failed after 0 rows: duplicate key value (v)=(2) violates unique constraint "woo"
exec stmt execution failed after 0 rows: duplicate key value violates unique constraint "woo"\nDETAIL: Key (v)=(2) already exists\.

statement ok
SET tracing = on,kv,results; CREATE TABLE t.kv2 AS TABLE t.kv; SET tracing = off
Expand Down
Loading

0 comments on commit 868411c

Please sign in to comment.