fix: add AT and ZONE to PostgreSQL SQL keywords for prepareSql
The prepareSql function quotes any word not in SQL_KEYWORDS as an identifier. Since AT and ZONE were missing from the set, the expression (NOW() AT TIME ZONE 'UTC') was mangled into (NOW() "AT" TIME "ZONE" 'UTC'), causing INSERT failures on PostgreSQL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -339,7 +339,11 @@ const SQL_KEYWORDS = new Set([
|
|||||||
'IF',
|
'IF',
|
||||||
'CURRENT_TIMESTAMP',
|
'CURRENT_TIMESTAMP',
|
||||||
'NOW',
|
'NOW',
|
||||||
'GETDATE'
|
'GETDATE',
|
||||||
|
|
||||||
|
// ==================== Timezone Expression ====================
|
||||||
|
'AT',
|
||||||
|
'ZONE'
|
||||||
])
|
])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ describe('PostgreSqlDialect', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('currentTimestamp', () => {
|
describe('currentTimestamp', () => {
|
||||||
it('should return CURRENT_TIMESTAMP', () => {
|
it('should return explicit UTC timestamp expression', () => {
|
||||||
expect(dialect.currentTimestamp()).toBe('CURRENT_TIMESTAMP')
|
expect(dialect.currentTimestamp()).toBe("(NOW() AT TIME ZONE 'UTC')")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user