From 181ec7aef5460ed0fe9f11d5075e193cf24d2c06 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 5a22630..b1e5367 100644 --- a/mysql_fdw.c +++ b/mysql_fdw.c @@ -2138,7 +2138,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 (");