From c55ec1eb1850e088727b8e66b945a6aa12d891d2 Mon Sep 17 00:00:00 2001 From: "Mark H. Wilkinson" Date: Wed, 9 Sep 2020 16:46:10 +0100 Subject: [PATCH] Make IMPORT FOREIGN SCHEMA behave consistently 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 #202. --- mysql_fdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_fdw.c b/mysql_fdw.c index cb9f8d1..9b09efd 100644 --- a/mysql_fdw.c +++ b/mysql_fdw.c @@ -1774,7 +1774,7 @@ mysqlImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid) { bool first_item = true; - appendStringInfoString(&buf, " AND t.TABLE_NAME "); + appendStringInfoString(&buf, " AND t.TABLE_NAME COLLATE UTF8_GENERAL_CI "); if (stmt->list_type == FDW_IMPORT_SCHEMA_EXCEPT) appendStringInfoString(&buf, "NOT "); appendStringInfoString(&buf, "IN (");