-
Notifications
You must be signed in to change notification settings - Fork 162
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
IMPORT FOREIGN SCHEMA behaves differently depending on mysql server's lower_case_table_names setting #202
Comments
Thanks @mhw for reporting this issue. Your analysis seems correct to me. I too observed that mysql 5.7 has lower_case_table_names set to 2 by default and got below results. Will see how we can fix this. MacOS mysql 5.7: mysql> show variables like 'lower_case_%'; mysql> select t.table_name mysql> select t.table_name from information_schema.tables as t where t.table_name collate utf8_general_ci in ('articleGalleryImage'); |
The case of the table names returned by information_schema queries depends on MySQL's `lower_case_table_names` setting. https://dev.mysql.com/doc/refman/5.7/en/charset-collation-information-schema.html suggests forcing a suitable collation to work around the issue. Fixes EnterpriseDB#202.
The case of the table names returned by information_schema queries depends on MySQL's `lower_case_table_names` setting. https://dev.mysql.com/doc/refman/5.7/en/charset-collation-information-schema.html suggests forcing a suitable collation to work around the issue. Fixes EnterpriseDB#202.
HI @mhw, We have analysed this issue further and found that if we add
Moreover, Windows and macOS are the non-supported platforms for mysql_fdw. Please check below supported platform and we recommend using any of them. Hope this helps. |
I have a database in MySQL on Linux (for production) and macOS (for development). In that database some table names use mixed-case (e.g. articleGalleryImage). I was trying to write a database migration that is portable from development to production.
On macOS in development (mysql_fdw version 2.5.3, mysql server version 5.7.29 Homebrew, PostgreSQL server 12.3 also from Homebrew):
completes successfully, but creates no foreign table, while
works, and creates a foreign table called
articlegalleryimage
.On Linux (mysql_fdw version 2.5.3, mysql server version 5.7.31-0ubuntu0.18.04.1-log, PostgreSQL server 12.3 (Ubuntu 12.3-1.pgdg18.04+1)) the reverse is true and the foreign table is called
articleGalleryImage
. This makes it tricky to write a single statement that will work on both platforms. It also means that resulting schemas objects have different names.I think the cause could be mysql's
lower_case_table_names
setting. On macOS the default for this is2
, while on Linux it is0
. I've pared down the query that is run to get the table details from MySQL's information schema to the following:Running this on macOS I get this:
Note that the
table_name
value has been lower-cased: the actual table name is mixed case in the database schema, but this seems to be a quirk of MySQL. On Linux I get this:Reading https://dev.mysql.com/doc/refman/5.7/en/charset-collation-information-schema.html suggests a possible solution might be to force the collation - again on macOS:
I'll see if I can make that modification and report back.
The text was updated successfully, but these errors were encountered: