From 5a9283ad859bfd0277baadd9f2f9263da2ebcade Mon Sep 17 00:00:00 2001 From: garrettmills Date: Tue, 19 Oct 2021 13:59:00 -0500 Subject: [PATCH] orm(PostgreSQLDialect): double-quote column names in INSERT field lists --- src/orm/dialect/PostgreSQLDialect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/orm/dialect/PostgreSQLDialect.ts b/src/orm/dialect/PostgreSQLDialect.ts index 9a20640..ccf493b 100644 --- a/src/orm/dialect/PostgreSQLDialect.ts +++ b/src/orm/dialect/PostgreSQLDialect.ts @@ -230,7 +230,7 @@ export class PostgreSQLDialect extends SQLDialect { const table: string = tableString.split('.').map(x => `"${x}"`) .join('.') queryLines.push('INSERT INTO ' + (typeof source === 'string' ? table : `${table} AS "${source.alias}"`) - + (columns.length ? ` (${columns.join(', ')})` : '')) + + (columns.length ? ` (${columns.map(x => `"${x}"`).join(', ')})` : '')) } if ( Array.isArray(data) && !data.length ) {