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 too aggressive evaluation of args in default column expr #44547

Merged
merged 3 commits into from
Jan 16, 2023

Conversation

tavplubix
Copy link
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in official stable or prestable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Fixed a bug in normalization of a DEFAULT expression in CREATE TABLE statement. The second argument of function in (or the right argument of operator IN) might be replaced with the result of its evaluation during CREATE query execution. Fixes #44496

@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-bugfix Pull request with bugfix, not backported by default label Dec 23, 2022
@Avogar Avogar self-assigned this Dec 27, 2022
@Avogar
Copy link
Member

Avogar commented Jan 13, 2023

Can you look at the Fast test failure?

@tavplubix
Copy link
Member Author

Yep, I'm looking at it right now :)

@tavplubix
Copy link
Member Author

Stress test (asan) - #45308
Stress test (debug) - OOM in dmesg

@tavplubix tavplubix merged commit ee888f7 into master Jan 16, 2023
@tavplubix tavplubix deleted the fix_44496 branch January 16, 2023 12:09
@tavplubix tavplubix added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Jan 16, 2023
robot-clickhouse added a commit that referenced this pull request Jan 16, 2023
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jan 16, 2023
tavplubix added a commit that referenced this pull request Jan 17, 2023
Backport #44547 to 22.12: Fix too aggressive evaluation of args in default column expr
if (!args || args->children.size() != 2)
return -1;

if (args->children[1]->as<ASTFunction>())
Copy link
Member

@vitlibar vitlibar Feb 7, 2023

Choose a reason for hiding this comment

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

@tavplubix You're checking only for ASTFunction here but what if the second argument of IN is a subquery? Like x IN (SELECT id FROM tbl). SELECT id FROM tbl isn't a function but it seems it doesn't need to be evaluated during normalization.

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see

- there is another check for ASTFunction so the normalization evaluates only functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Right argument of IN is evaluated in a column default expression in 22.10+
5 participants