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 when use lower_case_table_names 0 in mysql #2524

Closed
wants to merge 1 commit into from
Closed

Fix when use lower_case_table_names 0 in mysql #2524

wants to merge 1 commit into from

Conversation

yamoe
Copy link

@yamoe yamoe commented May 9, 2018

No description provided.

@arikfr
Copy link
Member

arikfr commented May 18, 2018

Can you explain a bit more about what's going on here? thanks :)

@yamoe
Copy link
Author

yamoe commented May 22, 2018

sorry, there is typo.

if set lower_case_table_names to 0 in mysql, column name is in upper case.
(0 is default value on linux mysql)
thus, there is an error in later code.

row['table_schema'] will generate an error. (redash/redash/query_runner/mysql.py line 117)
This is because table_name is actually in upper case.

@yamoe
Copy link
Author

yamoe commented May 22, 2018

references about lower_case_table_names : https://dev.mysql.com/doc/refman/8.0/en/identifier-case-sensitivity.html

col.column_name
SELECT col.TABLE_SCHEMA as table_schema,
col.TABLE_NAME as table_name,
col.COLUMN_NAME as column_name
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this breaking for anyone who didn't set local_case_table_names to 0?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll answer instead: no, it will not, because originally all column names in information_schema are upper-cased. When lower_case_table_names == 0 - then query must use upper-cased names as well; when lower_case_table_names != 0 - no matter what case the query use, MySQL will use CI comparison. So common denominator is to always use upper-cased names.

@kravets-levko
Copy link
Collaborator

@arikfr isn't this fix related to #4547?

@arikfr
Copy link
Member

arikfr commented Jan 21, 2020

@arikfr isn't this fix related to #4547?

They seem to address similar things, but not sure if it's the same thing.

@kravets-levko kravets-levko changed the title fix when use local_case_table_names 0 in mysql Fix when use lower_case_table_names 0 in mysql Jan 21, 2020
@kravets-levko
Copy link
Collaborator

They seem to address similar things, but not sure if it's the same thing.

Yeah, I see now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants