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.1: parser: fix GetTypeFromValidSQLSyntax for collated strings #97492

Merged

Conversation

yuzefovich
Copy link
Member

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:09
@yuzefovich yuzefovich requested review from a team as code owners February 22, 2023 17:09
@yuzefovich yuzefovich requested a review from michae2 February 22, 2023 17:09
@yuzefovich yuzefovich changed the title parser: fix GetTypeFromValidSQLSyntax for collated strings release-22.1: parser: fix GetTypeFromValidSQLSyntax for collated strings Feb 22, 2023
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@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.

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.1-96695-97435 branch from 5e671d2 to 01e7612 Compare February 22, 2023 18:00
@yuzefovich yuzefovich merged commit e842323 into cockroachdb:release-22.1 Feb 27, 2023
@yuzefovich yuzefovich deleted the backport22.1-96695-97435 branch February 27, 2023 23:35
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