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

bug: When case sensitivity is enabled, some system functions cannot be used #16737

Open
1 of 2 tasks
cdmikechen opened this issue Oct 31, 2024 · 1 comment
Open
1 of 2 tasks
Labels
C-bug Category: something isn't working good first issue Category: good first issue

Comments

@cdmikechen
Copy link

cdmikechen commented Oct 31, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

v1.2.642-nightly

What's Wrong?

The version function cannot be used after unquoted_ident_case_sensitive is set to the global configuration.

SELECT VERSION() :

(databend_sqlalchemy.errors.Error) Code: None. APIError: ResponseError with 1008: error:
  --> SQL:1:8
  |
1 | SELECT VERSION()
  |        ^^^^^^^^^ no function matches the given name: 'VERSION', do you mean 'version', 'haversine'?
[SQL: SELECT VERSION()]
(Background on this error at: https://sqlalche.me/e/14/dbapi)

SELECT currentDatabase() :

(databend_sqlalchemy.errors.Error) Code: None. APIError: ResponseError with 1008: error:
  --> SQL:1:8
  |
1 | SELECT currentDatabase()
  |        ^^^^^^^^^^^^^^^^^ no function matches the given name: 'currentDatabase', do you mean 'currentdatabase', 'current_database', 'currentuser', 'current_user', 'current_role', 'current_timestamp'?

In my understanding, case sensitivity should only be applied to user-created table names and field names, and system functions should not need this criterion.

How to Reproduce?

SET GLOBAL unquoted_ident_case_sensitive=1;
SELECT VERSION();

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@cdmikechen cdmikechen added the C-bug Category: something isn't working label Oct 31, 2024
@sundy-li sundy-li added the good first issue Category: good first issue label Oct 31, 2024
@sundy-li
Copy link
Member

 let func_name = normalize_identifier(name, self.name_resolution_ctx).to_string();
                let func_name = func_name.as_str();
                if !is_builtin_function(func_name)
                    && !Self::all_sugar_functions().contains(&func_name)

we should search by the lowercase of func_name .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something isn't working good first issue Category: good first issue
Projects
None yet
Development

No branches or pull requests

2 participants