orm(PostgreSQLDialect): double-quote column names in INSERT field lists

This commit is contained in:
Garrett Mills 2021-10-19 13:59:00 -05:00
parent b1ea489ccb
commit 5a9283ad85

View File

@ -230,7 +230,7 @@ export class PostgreSQLDialect extends SQLDialect {
const table: string = tableString.split('.').map(x => `"${x}"`) const table: string = tableString.split('.').map(x => `"${x}"`)
.join('.') .join('.')
queryLines.push('INSERT INTO ' + (typeof source === 'string' ? table : `${table} AS "${source.alias}"`) 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 ) { if ( Array.isArray(data) && !data.length ) {