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

Fix IN array_unpack for bigints #3820

Merged
merged 1 commit into from
May 3, 2022
Merged

Fix IN array_unpack for bigints #3820

merged 1 commit into from
May 3, 2022

Conversation

msullivan
Copy link
Member

The way we insert casts for the comparison operator breaks on
array_unpacks.

Also, we failed to take into account the scopes that we skipped over,
which caused trouble in the double cast cases.

Fixes #3817.

The way we insert casts for the comparison operator breaks on
array_unpacks.

Also, we failed to take into account the scopes that we skipped over,
which caused trouble in the double cast cases.

Fixes #3817.
@msullivan msullivan requested a review from elprans May 3, 2022 22:33
@@ -1389,6 +1392,11 @@ def process_set_as_membership_expr(
left_is_row_expr = astutils.is_row_expr(left_out)

with newctx.subrel() as _, _.newscope() as subctx:
if is_array_unpack:
relctx.update_scope(orig_right_arg, subctx.rel, ctx=subctx)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to update_scope on both orig_ and unwrapped_?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because if unwrapped_ has a path_scope_id, then that takes precedence, but otherwise we want to use orig_'s

@msullivan msullivan merged commit cfb1035 into master May 3, 2022
@msullivan msullivan deleted the cast-in-unpack branch May 3, 2022 23:37
@msullivan
Copy link
Member Author

Cherry-picked for 1.4

msullivan added a commit that referenced this pull request May 9, 2022
The way we insert casts for the comparison operator breaks on
array_unpacks.

Also, we failed to take into account the scopes that we skipped over,
which caused trouble in the double cast cases.

Fixes #3817.
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.

ISE in foo IN array_unpack(<double-array-cast>)
2 participants