diff --git a/duckdb b/duckdb index a6e32b1..fa5c2fe 160000 --- a/duckdb +++ b/duckdb @@ -1 +1 @@ -Subproject commit a6e32b115826ba543e32a733cb92f68fd0549186 +Subproject commit fa5c2fe15f3da5f32397b009196c0895fce60820 diff --git a/src/storage/mysql_insert.cpp b/src/storage/mysql_insert.cpp index 1db6df7..7a62b23 100644 --- a/src/storage/mysql_insert.cpp +++ b/src/storage/mysql_insert.cpp @@ -82,7 +82,7 @@ string GetBaseInsertQuery(const MySQLTableEntry &table, const vector &co if (c > 0) { query += ", "; } - query += column_names[c]; + query += MySQLUtils::WriteIdentifier(column_names[c]); } query += ")"; } diff --git a/test/sql/attach_identifiers_insert.test b/test/sql/attach_identifiers_insert.test new file mode 100644 index 0000000..1502d12 --- /dev/null +++ b/test/sql/attach_identifiers_insert.test @@ -0,0 +1,21 @@ +# name: test/sql/attach_identifiers_insert.test +# description: Test insert by name with odd identifiers +# group: [sql] + +require mysql_scanner + +require-env MYSQL_TEST_DATABASE_AVAILABLE + +statement ok +ATTACH 'host=localhost user=root port=0 database=mysqlscanner' AS s (TYPE MYSQL_SCANNER) + +statement ok +CREATE OR REPLACE TABLE s."my table"("my column" INTEGER); + +statement ok +INSERT INTO s."my table" BY NAME SELECT 42 "my column" + +query I +SELECT * FROM s."my table" +---- +42