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-20.2: sql: wrap typed Array within IndirectionExpr in ParenExpr #63775

Merged
merged 1 commit into from
Apr 19, 2021
Merged

release-20.2: sql: wrap typed Array within IndirectionExpr in ParenExpr #63775

merged 1 commit into from
Apr 19, 2021

Conversation

the-ericwang35
Copy link
Contributor

Backport 1/1 commits from #63271.

/cc @cockroachdb/release


This patch adds a case that #63103 missed.

When we have something like ARRAY['a'::typ, 'b'::typ],
we format it to ARRAY['a'::typ, 'b'::typ]:::public.typ[].
This causes issues if used in an IndirectionExpr, such as
ARRAY['a'::typ, 'b'::typ]:::public.typ[][1], as the [1]
is interpreted as part of the type.
This would result in errors when trying to use these
expressions in default expressions.
This patch checks for this specific case, and instead
formats it as (ARRAY['a'::typ, 'b'::typ]:::public.typ[])[1].

Release note: None

This patch adds a case that #63103 missed.

When we have something like `ARRAY['a'::typ, 'b'::typ]`,
we format it to `ARRAY['a'::typ, 'b'::typ]:::public.typ[]`.
This causes issues if used in an `IndirectionExpr`, such as
`ARRAY['a'::typ, 'b'::typ]:::public.typ[][1]`, as the `[1]`
is interpreted as part of the type.
This would result in errors when trying to use these
expressions in default expressions.
This patch checks for this specific case, and instead
formats it as `(ARRAY['a'::typ, 'b'::typ]:::public.typ[])[1]`.

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@the-ericwang35 the-ericwang35 requested a review from ajwerner April 16, 2021 16:36
Copy link
Contributor

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

@the-ericwang35 the-ericwang35 merged commit 0f7c01f into cockroachdb:release-20.2 Apr 19, 2021
@the-ericwang35 the-ericwang35 deleted the backport20.2-63271 branch April 19, 2021 14:23
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