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

sql: wrap typed Array within IndirectionExpr in ParenExpr #63271

Merged
merged 1 commit into from
Apr 8, 2021
Merged

sql: wrap typed Array within IndirectionExpr in ParenExpr #63271

merged 1 commit into from
Apr 8, 2021

Conversation

the-ericwang35
Copy link
Contributor

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
@the-ericwang35 the-ericwang35 requested a review from ajwerner April 8, 2021 03:14
@cockroach-teamcity
Copy link
Member

This change is Reviewable

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: cc @rafiss

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @the-ericwang35)

@the-ericwang35
Copy link
Contributor Author

TFTRs!

bors r=ajwerner,rafiss

@craig
Copy link
Contributor

craig bot commented Apr 8, 2021

Build succeeded:

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.

4 participants