sql: allow creation of tables with no primary key#3286
sql: allow creation of tables with no primary key#3286madelynnblue merged 1 commit intocockroachdb:masterfrom madelynnblue:sql-no-primary-key
Conversation
|
Can you file the other bugs you found? I'd really like for this to go in with the associated logic test enablement. |
sql/create.go
Outdated
There was a problem hiding this comment.
instead of relying on this error, can you check for the presence of a primary key directly?
There was a problem hiding this comment.
I tried that, and it sadly doesn't work. I duplicated the check in Validate for no primary keys, but the fields it relies on to do that are populated near the end of AllocateIDs, right before it calls Validate itself. Hence the double call to AllocateIDs in this function.
There was a problem hiding this comment.
I don't follow; you can't do if len(desc.PrimaryIndex.ColumnNames) == 0? The check in Validate is checking that the IDs were assigned, but you can just look at the names here.
|
Sure, I'll file the other bugs. |
|
Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. sql/create.go, line 132 [r1] (raw file): sql/create.go, line 134 [r1] (raw file): sql/testdata/no_primary_key, line 10 [r1] (raw file): sql/testdata/no_primary_key, line 26 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions. sql/create.go, line 132 [r1] (raw file): sql/create.go, line 134 [r1] (raw file): sql/testdata/no_primary_key, line 26 [r1] (raw file): Comments from the review on Reviewable.io |
sql/create.go
Outdated
There was a problem hiding this comment.
nit: const s = "experimental_unique_int()"
There was a problem hiding this comment.
ah, taking the address. That probably ruins it.
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/create.go, line 132 [r2] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/create.go, line 132 [r2] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/testdata/no_primary_key, line 10 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/create.go, line 132 [r2] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/create.go, line 130 [r1] (raw file): Line 246 in 28a6c07 Is where desc.PrimaryIndex.ColumnIDs is appended inside of the AllocateIDs func. The create function could go through and manually examine all indicies to see if any are primary, but it may be better to keep that logic in one place in AllocateIDs. Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/testdata/no_primary_key, line 10 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/create.go, line 132 [r2] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/testdata/no_primary_key, line 10 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/create.go, line 130 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 0 of 2 files reviewed at latest revision, 6 unresolved discussions. sql/testdata/no_primary_key, line 10 [r1] (raw file): Comments from the review on Reviewable.io |
|
Reviewed 1 of 2 files at r1, 1 of 2 files at r2, 1 of 1 files at r3. sql/create.go, line 132 [r1] (raw file): Comments from the review on Reviewable.io |
|
LGTM Review status: all files reviewed at latest revision, 3 unresolved discussions. sql/create.go, line 132 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 1 of 2 files reviewed at latest revision, 3 unresolved discussions. sql/create.go, line 130 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 1 of 2 files reviewed at latest revision, 3 unresolved discussions. sql/create.go, line 132 [r1] (raw file): Comments from the review on Reviewable.io |
|
Reviewed 1 of 1 files at r4. Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 3 unresolved discussions. sql/testdata/no_primary_key, line 38 [r4] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 3 unresolved discussions. sql/create.go, line 132 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 1 of 2 files reviewed at latest revision, 3 unresolved discussions, some commit checks pending. sql/create.go, line 132 [r1] (raw file): sql/testdata/no_primary_key, line 38 [r4] (raw file): Comments from the review on Reviewable.io |
|
Review status: 1 of 2 files reviewed at latest revision, 1 unresolved discussion. sql/create.go, line 132 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 1 of 2 files reviewed at latest revision, 1 unresolved discussion. sql/create.go, line 132 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 1 of 2 files reviewed at latest revision, 1 unresolved discussion. sql/create.go, line 132 [r1] (raw file): Comments from the review on Reviewable.io |
sql: allow creation of tables with no primary key
|
Reviewed 1 of 1 files at r5. Comments from the review on Reviewable.io |
fixes #2081