Skip to content
New issue

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

release-22.2: parser: fix GetTypeFromValidSQLSyntax for collated strings #97491

Merged

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Feb 22, 2023

Backport:

Please see individual PRs for details.

Two commits are squashed into one.

/cc @cockroachdb/release

Release justification: bug fix.

@yuzefovich yuzefovich requested a review from rafiss February 22, 2023 17:04
@yuzefovich yuzefovich requested review from a team as code owners February 22, 2023 17:04
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich changed the title parser: fix GetTypeFromValidSQLSyntax for collated strings release-22.2: parser: fix GetTypeFromValidSQLSyntax for collated strings Feb 22, 2023
@yuzefovich
Copy link
Member Author

I'll hold off on merging this for a few days in order to let any lurking bugs around collated strings to be exposed.

Copy link
Collaborator

@rharding6373 rharding6373 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @rafiss)

Previously, `GetTypeFromValidSQLSyntax` would result in an error when
attempting to parse a collated string. This is due to an expression like
`1::STRING COLLATE en` being parsed as `CollateExpr(CastExpr)` whereas
the function expected just `CastExpr`. This is now fixed by having
a special case for the collated strings.

Additionally, this commit adds a couple of testing improvements around
the collated strings:
- a representative collated string type is now included into
`randgen.SeedTypes` (this actually exposed a minor bug in recently
introduced `tree.DatumPrev` and `tree.DatumNext` methods, now fixed in
this commit)
- a new test is introduced that asserts that for all (with a few
exceptions) type families at least one representative type is included
into `randgen.SeedTypes`.

Release note (bug fix): Previously, `ALTER TABLE ... INJECT STATISTICS`
command would fail if a column with COLLATED STRING type had histograms
to be injected, and this is now fixed. The bug has been present since at
least 21.2.
@yuzefovich yuzefovich force-pushed the backport22.2-96695-97435 branch from 314dfee to 47ca688 Compare February 23, 2023 17:16
@yuzefovich yuzefovich merged commit d5a076f into cockroachdb:release-22.2 Feb 27, 2023
@yuzefovich yuzefovich deleted the backport22.2-96695-97435 branch February 27, 2023 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants