sql: fix crdb_internal.encode_key in some contexts#107512
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Jul 26, 2023
Merged
sql: fix crdb_internal.encode_key in some contexts#107512craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Member
ecwall
approved these changes
Jul 25, 2023
Contributor
ecwall
left a comment
There was a problem hiding this comment.
Looks good. I saw you are backporting to 23.1 - can it be backported to 22.2 also?
rharding6373
approved these changes
Jul 25, 2023
Collaborator
rharding6373
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @yuzefovich)
pkg/sql/planner.go line 449 at r1 (raw file):
p.extendedEvalCtx.Locality = execCfg.Locality p.extendedEvalCtx.OriginalLocality = execCfg.Locality p.extendedEvalCtx.CatalogBuiltins = &p.evalCatalogBuiltins
nit: We initialize p.evalCatalogBuiltins after this block. It's a bit of an anti-pattern, even if it currently works correctly.
Contributor
|
You might need a fix similar to #107099 for the |
Previously, we forgot to set `CatalogBuiltins` for the internal planner which is used by `crdb_internal.encode_key` (which, in turn, is used to power `SHOW RANGE ... FOR ROW`), so evaluating it would lead to an error. For example, the internal planner is used in the backfill. This is now fixed. Release note (bug fix): CockroachDB would previously return an error when using `SHOW RANGE ... FOR ROW ...` in `CREATE TABLE ... AS ...` construct, and this is now fixed.
d3095f9 to
574a09e
Compare
yuzefovich
commented
Jul 26, 2023
Member
Author
yuzefovich
left a comment
There was a problem hiding this comment.
Thanks for the pointer and the reviews!
bors r+
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @mgartner)
Contributor
|
Build succeeded: |
This was referenced Jul 26, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, we forgot to set
CatalogBuiltinsfor the internal planner which is used bycrdb_internal.encode_key(which, in turn, is used to powerSHOW RANGE ... FOR ROW), so evaluating it would lead to an error. For example, the internal planner is used in the backfill. This is now fixed.Fixes: #106397.
Release note (bug fix): CockroachDB would previously return an error when using
SHOW RANGE ... FOR ROW ...inCREATE TABLE ... AS ...construct, and this is now fixed.