Skip to content

Commit 897d1d6

Browse files
danedmundstaozhi8833998
authored andcommitted
fix: snowflake double quote escape
1 parent dd899b5 commit 897d1d6

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

pegjs/snowflake.pegjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4239,6 +4239,7 @@ escape_char
42394239
}
42404240
/ "\\" { return "\\"; }
42414241
/ "''" { return "''" }
4242+
/ '""' { return '""' }
42424243

42434244
line_terminator
42444245
= [\n\r]

test/snowflake.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,20 @@ describe('snowflake', () => {
525525
'SELECT "a" + "b" FROM DUAL'
526526
]
527527
},
528+
{
529+
title: 'escape double quoted',
530+
sql: [
531+
'SELECT "foo""bar"',
532+
'SELECT "foo""bar"'
533+
]
534+
},
535+
{
536+
title: 'escape double quoted twice',
537+
sql: [
538+
'SELECT "my ""column"""',
539+
'SELECT "my ""column"""'
540+
]
541+
},
528542
]
529543
SQL_LIST.forEach(sqlInfo => {
530544
const { title, sql } = sqlInfo

0 commit comments

Comments
 (0)