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

MDEV-33010 Condition with CHARSET()/COERCIBILITY() erroneously pushed… #3167

Open
wants to merge 1 commit into
base: 10.5
Choose a base branch
from

Conversation

Olernov
Copy link
Contributor

@Olernov Olernov commented Apr 1, 2024

… into derived table

Based on the current logic, objects of classes Item_func_charset and Item_func_coercibility (responsible for CHARSET() and COERCIBILITY() functions) are always considered const.
However, SQL syntax allows their use in a non-constant manner, such as CHARSET(t1.a), COERCIBILITY(t1.a), and similar.

This "const-forcing" was introduced with
commit aa1002a.

When those objects are erroneously deemed const, it could lead to unwanted consequences like pushing down conditions to materialized derived tables illegitimately.

This commits removes the "const-forcing" for Item_func_charset and Item_func_coercibility, making them determine their constness in the general way

  • The Jira issue number for this PR is: MDEV-_33010

Release Notes

TODO: What should the release notes say about this change?
Include any changed system variables, status variables or behaviour. Optionally list any https://mariadb.com/kb/ pages that need changing.

How can this PR be tested?

TODO: modify the automated test suite to verify that the PR causes MariaDB to behave as intended.
Consult the documentation on "Writing good test cases".

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • This is a new feature and the PR is based against the latest MariaDB development branch.
  • This is a bug fix and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

… into derived table

Based on the current logic, objects of classes Item_func_charset and
Item_func_coercibility (responsible for CHARSET() and COERCIBILITY()
functions) are always considered const.
However, SQL syntax allows their use in a non-constant manner, such as
CHARSET(t1.a), COERCIBILITY(t1.a), and similar.

This "const-forcing" was introduced with
commit aa1002a.

When those objects are erroneously deemed const, it could lead to
unwanted consequences like pushing down conditions to materialized
derived tables illegitimately.

This commits removes the "const-forcing" for Item_func_charset and
Item_func_coercibility, making them determine their constness in
the general way
@anson1014
Copy link
Contributor

anson1014 commented Apr 2, 2024

Good catch, the fix makes sense and the accompanying test seems to accurately depict the scenario you are describing in your description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants