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

[MySQL Compatibility 1/4][Bug] Fix bug that set sql_mode with concat() function failed #4359

Merged
merged 6 commits into from
Aug 26, 2020

Conversation

morningman
Copy link
Contributor

@morningman morningman commented Aug 16, 2020

Proposed changes

Support set sql_mode = concat(@@sql_mode, "STRICT_TRANS_TABLES");

Types of changes

  • Bugfix (non-breaking change which fixes an issue)

Checklist

@morningman morningman added kind/fix Categorizes issue or PR as related to a bug. area/mysql-compatibility Issues or PRs related to the mysql compatibility labels Aug 16, 2020
@morningman morningman self-assigned this Aug 16, 2020
@morningman morningman changed the title [Bug] Fix bug that set sql_mode with concat() function failed [MySQL Compatibility 1/4][Bug] Fix bug that set sql_mode with concat() function failed Aug 16, 2020
try {
VariableMgr.fillValue(ConnectContext.get().getSessionVariable(), (SysVariableDesc) constExpr);
return ((SysVariableDesc) constExpr).getLiteralExpr();
} catch (AnalysisException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just throw the exception to the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is used for constant folding rules. If it fails, it will directly return to the original expression, and other processes will handle this error.

Copy link
Contributor

@kangkaisen kangkaisen left a comment

Choose a reason for hiding this comment

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

+1

@kangkaisen kangkaisen added the approved Indicates a PR has been approved by one committer. label Aug 25, 2020
@morningman morningman merged commit 0040153 into apache:master Aug 26, 2020
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
morningman pushed a commit that referenced this pull request Nov 18, 2021
…and MySQL (#7108)

Introduce by pr #4359

VariableMgr.fillValue() method should not call in ExpressionFunctions.eval(),
because in method analyzeImpl() of SysVariableDesc, it has been already called once.

If VariableMgr.fillValue() was called twice, the type of SysVariableDesc will become BigInt,
which is incorrect.
@fengyunhe
Copy link

fengyunhe commented Nov 16, 2024

BUT still failed for this (when I use SAP DataService to connect Doris ):

SET SESSION sql_mode = (SELECT CONCAT(@@sql_mode,',ANSI_QUOTES'));

the client side auto execute this when connect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. area/mysql-compatibility Issues or PRs related to the mysql compatibility kind/fix Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] set sql_mode with concat() function failed.
5 participants