Skip to content

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

Merged
morningman merged 6 commits into
apache:masterfrom
morningman:set_var_expr
Aug 26, 2020
Merged

[MySQL Compatibility 1/4][Bug] Fix bug that set sql_mode with concat() function failed#4359
morningman merged 6 commits into
apache:masterfrom
morningman:set_var_expr

Conversation

@morningman

@morningmanmorningman commented Aug 16, 2020

Copy link
Copy Markdown
Contributor

Proposed changes

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

Types of changes

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

Checklist

@morningmanmorningman 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
@morningmanmorningman self-assigned this Aug 16, 2020
@morningmanmorningman 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 failedAug 16, 2020
try {
VariableMgr.fillValue(ConnectContext.get().getSessionVariable(), (SysVariableDesc) constExpr);
return ((SysVariableDesc) constExpr).getLiteralExpr();
} catch (AnalysisException e) {

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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.

@kangkaisenkangkaisen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@kangkaisenkangkaisen added the approved Indicates a PR has been approved by one committer. label Aug 25, 2020
@morningman
morningman merged commit 0040153 into apache:masterAug 26, 2020
@yangzhgyangzhg 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

fengyunhe commented Nov 16, 2024

Copy link
Copy Markdown

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

Hastyshell pushed a commit to Hastyshell/doris that referenced this pull request Sep 12, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.area/mysql-compatibilityIssues or PRs related to the mysql compatibilitykind/fixCategorizes 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

@morningman@fengyunhe@kangkaisen@EmmyMiao87@morningman-cmy