Skip to content

Commit f2a1501

Browse files
authored
Merge pull request #88 from Mytherin/issue87
Fix #87 - correctly quote column identifiers in INSERT INTO statement
2 parents d0c56ab + 53c8258 commit f2a1501

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

duckdb

Submodule duckdb updated 127 files

src/storage/mysql_insert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ string GetBaseInsertQuery(const MySQLTableEntry &table, const vector<string> &co
8282
if (c > 0) {
8383
query += ", ";
8484
}
85-
query += column_names[c];
85+
query += MySQLUtils::WriteIdentifier(column_names[c]);
8686
}
8787
query += ")";
8888
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# name: test/sql/attach_identifiers_insert.test
2+
# description: Test insert by name with odd identifiers
3+
# group: [sql]
4+
5+
require mysql_scanner
6+
7+
require-env MYSQL_TEST_DATABASE_AVAILABLE
8+
9+
statement ok
10+
ATTACH 'host=localhost user=root port=0 database=mysqlscanner' AS s (TYPE MYSQL_SCANNER)
11+
12+
statement ok
13+
CREATE OR REPLACE TABLE s."my table"("my column" INTEGER);
14+
15+
statement ok
16+
INSERT INTO s."my table" BY NAME SELECT 42 "my column"
17+
18+
query I
19+
SELECT * FROM s."my table"
20+
----
21+
42

0 commit comments

Comments
 (0)