From 32c7ee8964affbb51cacd3868fa82d76607b44c7 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 864cbc7..79a5622 100644 --- a/mysql_fdw.c +++ b/mysql_fdw.c @@ -1699,7 +1699,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 (");