Skip to content

Commit

Permalink
Test case for issue 202
Browse files Browse the repository at this point in the history
  • Loading branch information
mhw committed Sep 9, 2020
1 parent 8912bbb commit 3af96b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions expected/select.out
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,17 @@ SELECT * FROM enum_t1 ORDER BY id;
(3 rows)

DROP FOREIGN TABLE enum_t1;
-- Issue #202 - correct handling of mixed-case table names.
IMPORT FOREIGN SCHEMA mysql_fdw_regress LIMIT TO ("mixedCaseTable") FROM SERVER mysql_svr INTO public;
SELECT * FROM "mixedCaseTable" ORDER BY id;
id | mixedCaseColumn
----+-----------------
1 | small
2 | medium
3 | large
(3 rows)

DROP FOREIGN TABLE "mixedCaseTable";
-- Cleanup
DROP TABLE l_test_tbl1;
DROP TABLE l_test_tbl2;
Expand Down
3 changes: 3 additions & 0 deletions mysql_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress1 -e "DROP TABLE IF EXISTS student;"
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress1 -e "DROP TABLE IF EXISTS numbers;"
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e "DROP TABLE IF EXISTS enum_t1;"
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e "DROP TABLE IF EXISTS mixedCaseTable;"

mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e "CREATE TABLE mysql_test(a int primary key, b int);"
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e "INSERT INTO mysql_test(a,b) VALUES (1,1);"
Expand All @@ -40,3 +41,5 @@ mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress1 -e
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress1 -e "CREATE TABLE numbers (a int, b varchar(255));"
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e "CREATE TABLE enum_t1 (id int PRIMARY KEY, size ENUM('small', 'medium', 'large'));"
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e "INSERT INTO enum_t1 VALUES (1, 'small'),(2, 'medium'),(3, 'medium');"
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e "CREATE TABLE mixedCaseTable (id int PRIMARY KEY, mixedCaseColumn text);"
mysql -h $MYSQL_HOST -u $MYSQL_USER_NAME -P $MYSQL_PORT -D mysql_fdw_regress -e "INSERT INTO mixedCaseTable VALUES (1, 'small'),(2, 'medium'),(3, 'large');"
5 changes: 5 additions & 0 deletions sql/select.sql
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ IMPORT FOREIGN SCHEMA mysql_fdw_regress LIMIT TO (enum_t1) FROM SERVER mysql_svr
SELECT * FROM enum_t1 ORDER BY id;
DROP FOREIGN TABLE enum_t1;

-- Issue #202 - correct handling of mixed-case table names.
IMPORT FOREIGN SCHEMA mysql_fdw_regress LIMIT TO ("mixedCaseTable") FROM SERVER mysql_svr INTO public;
SELECT * FROM "mixedCaseTable" ORDER BY id;
DROP FOREIGN TABLE "mixedCaseTable";

-- Cleanup
DROP TABLE l_test_tbl1;
DROP TABLE l_test_tbl2;
Expand Down

0 comments on commit 3af96b1

Please sign in to comment.