Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upsql: assorted mutation fixes #31222
Conversation
knz
requested review from
jordanlewis and
BramGruneir
Oct 10, 2018
knz
added this to Triage
in SQL Front-end, Lang & Semantics
via automation
Oct 10, 2018
knz
requested review from
cockroachdb/sql-async-prs
as
code owners
Oct 10, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
knz
Oct 10, 2018
Member
I did manually check that the insert/upsert fast paths do verify check and column constraints. Also in the code it's pretty clear because both the slow and fast path the same GenerateInsertRow() method which performs the check.
This was not true in previous versions, but I had forgotten that I fixed this at some point :)
|
I did manually check that the insert/upsert fast paths do verify check and column constraints. Also in the code it's pretty clear because both the slow and fast path the same This was not true in previous versions, but I had forgotten that I fixed this at some point :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
knz
Oct 11, 2018
Member
I think I squashed them all. It would be great if this got reviewed and backported this week.
|
I think I squashed them all. It would be great if this got reviewed and backported this week. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
yay it's green |
BramGruneir
approved these changes
Oct 11, 2018
Just a few of small comments.
Well done!
Reviewed 10 of 10 files at r1, 3 of 3 files at r2, 4 of 4 files at r3, 2 of 2 files at r4, 6 of 6 files at r5, 3 of 3 files at r6, 1 of 1 files at r7, 2 of 2 files at r8, 2 of 2 files at r9, 2 of 2 files at r10.
Reviewable status:complete! 0 of 0 LGTMs obtained (and 1 stale)
pkg/sql/descriptor_mutation_test.go, line 307 at r9 (raw file):
_, err = sqlDB.Exec(`INSERT INTO t.test VALUES ('b', 'y', 'i')`) } if !testutils.IsError(err, "(IN|UP)SERT has more expressions than target columns, 3 expressions for 2 targets") {
Why would this be upsert?
pkg/sql/logictest/testdata/logic_test/collatedstring, line 219 at r1 (raw file):
('ü' COLLATE en) statement error value type collatedstring{de} doesn't match type STRING COLLATE en of column "a"
I prefer the earlier error. It was clearer on what was wrong.
pkg/sql/logictest/testdata/logic_test/delete, line 187 at r5 (raw file):
1 # Regression tests for #29494
subtest please
pkg/sql/logictest/testdata/logic_test/insert, line 545 at r3 (raw file):
# This test requires that the error message for a CHECK constraint # validation error be different than a column validation error. So we # test the former first, as a sanity check.
Subtest please, and please pass these through sqlfmt.
pkg/sql/logictest/testdata/logic_test/insert, line 566 at r4 (raw file):
# Verify that column constraints and CHECK handling occur before # foreign key validation.
subtest please
pkg/sql/logictest/testdata/logic_test/insert, line 577 at r4 (raw file):
statement error failed to satisfy CHECK constraint INSERT INTO derived(y) VALUES('abcd')
please add an FK violation here too then one that passes all checks, just to complete the test
pkg/sql/logictest/testdata/logic_test/insert, line 579 at r5 (raw file):
INSERT INTO derived(y) VALUES('abcd') # Regression tests for #29494
subtest please
pkg/sql/logictest/testdata/logic_test/update, line 395 at r3 (raw file):
# validation error be different than a column validation error. So we # test the former first, as a sanity check. statement ok
subtest please, and sqlfmt.
pkg/sql/logictest/testdata/logic_test/update, line 416 at r4 (raw file):
UPDATE tn2 SET y = 'abcd' # Verify that column constraints and CHECK handling occur before
subtest, and add an fk violation and then a case that passes all.
pkg/sql/logictest/testdata/logic_test/update, line 431 at r5 (raw file):
UPDATE derived SET y = 'abcd' # Regression tests for #29494
subtest please
Nice test.
pkg/sql/logictest/testdata/logic_test/upsert, line 601 at r3 (raw file):
# validation error be different than a column validation error. So we # test the former first, as a sanity check. statement ok
subtest please and sqlfmt
pkg/sql/logictest/testdata/logic_test/upsert, line 620 at r5 (raw file):
UPSERT INTO tn2(x, y) VALUES (123, 'abcd') # Regression tests for #29494
subtest please
pkg/sql/logictest/testdata/logic_test/upsert, line 648 at r8 (raw file):
ROLLBACK # Regression test for #31255
subtest please
pkg/sql/logictest/testdata/logic_test/upsert, line 662 at r10 (raw file):
UPSERT INTO tc VALUES (1,2) # Regression test for #29497
subtest please
knz
reviewed
Oct 11, 2018
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale)
pkg/sql/descriptor_mutation_test.go, line 307 at r9 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
Why would this be upsert?
See the 5 lines before: the test uses both forms one after the other.
pkg/sql/logictest/testdata/logic_test/collatedstring, line 219 at r1 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
I prefer the earlier error. It was clearer on what was wrong.
I'll file a followup PR to clarify. Having a detailed error message requires more and more complex code.
pkg/sql/logictest/testdata/logic_test/delete, line 187 at r5 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please
Done.
pkg/sql/logictest/testdata/logic_test/insert, line 545 at r3 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
Subtest please, and please pass these through sqlfmt.
Done.
sqlfmt doesn't make any change - it all fits on 1 line.
pkg/sql/logictest/testdata/logic_test/insert, line 566 at r4 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please
Done.
pkg/sql/logictest/testdata/logic_test/insert, line 577 at r4 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
please add an FK violation here too then one that passes all checks, just to complete the test
Done.
pkg/sql/logictest/testdata/logic_test/insert, line 579 at r5 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please
Done.
pkg/sql/logictest/testdata/logic_test/update, line 395 at r3 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please, and sqlfmt.
Done.
pkg/sql/logictest/testdata/logic_test/update, line 416 at r4 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest, and add an fk violation and then a case that passes all.
Done.
pkg/sql/logictest/testdata/logic_test/update, line 431 at r5 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please
Nice test.
Done.
pkg/sql/logictest/testdata/logic_test/upsert, line 601 at r3 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please and sqlfmt
Done.
pkg/sql/logictest/testdata/logic_test/upsert, line 620 at r5 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please
Done.
pkg/sql/logictest/testdata/logic_test/upsert, line 648 at r8 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please
Done.
pkg/sql/logictest/testdata/logic_test/upsert, line 662 at r10 (raw file):
Previously, BramGruneir (Bram Gruneir) wrote…
subtest please
Done.
knz
added some commits
Oct 10, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
should I prepare the backport already? |
BramGruneir
reviewed
Oct 11, 2018
And yes, go for it.
Reviewed 1 of 3 files at r12, 4 of 6 files at r15, 2 of 3 files at r16, 1 of 2 files at r19, 2 of 2 files at r20.
Reviewable status:complete! 0 of 0 LGTMs obtained (and 1 stale)
jordanlewis
approved these changes
Oct 11, 2018
Reviewed 5 of 10 files at r1, 12 of 12 files at r11, 3 of 3 files at r12, 4 of 4 files at r13, 2 of 2 files at r14, 5 of 6 files at r15, 2 of 3 files at r16, 1 of 1 files at r17, 2 of 2 files at r18, 2 of 2 files at r19.
Reviewable status:complete! 1 of 0 LGTMs obtained (and 1 stale)
pkg/sql/sqlbase/column_type_properties.go, line 654 at r12 (raw file):
if typ.Width > 0 && utf8.RuneCountInString(sv) > int(typ.Width) { return pgerror.NewErrorf(pgerror.CodeStringDataRightTruncationError,
yay! nice precise pg errors.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
cool thanks bors r+ |
bot
pushed a commit
that referenced
this pull request
Oct 11, 2018
knz
referenced this pull request
Oct 11, 2018
Merged
release-2.1: sql: assorted mutation fixes #31280
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
craig
bot
commented
Oct 11, 2018
Build succeeded |
knz commentedOct 10, 2018
•
edited
Fixes #25742.
Fixes #26106.
Fixes #29494.
Fixes #31255.
Fixes #29497.
This may even full address #26106 but I have a couple more checks to add first to confirm this.edit: it does