Skip to content

Commit 9f81905

Browse files
Merge pull request #2557 from taozhi8833998/feat-except-mysql
feat: support except in mysql
2 parents e8e58d3 + c42ca33 commit 9f81905

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

pegjs/mariadb.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'ELSE': true,
3131
'END': true,
3232
'EXISTS': true,
33+
'EXCEPT': true,
3334
'EXPLAIN': true,
3435

3536
'FALSE': true,
@@ -296,6 +297,7 @@ set_op
296297
}
297298
/ KW_MINUS { return 'minus' }
298299
/ KW_INTERSECT { return 'intersect' }
300+
/ KW_EXCEPT { return 'except' }
299301

300302
set_op_stmt
301303
= head:select_stmt tail:(__ set_op __ select_stmt)* __ ob: order_by_clause? __ l:limit_clause? {
@@ -3843,6 +3845,7 @@ KW_OVER = "OVER"i !ident_start
38433845
KW_UNION = "UNION"i !ident_start
38443846
KW_MINUS = "MINUS"i !ident_start
38453847
KW_INTERSECT = "INTERSECT"i !ident_start
3848+
KW_EXCEPT = "EXCEPT"i !ident_start
38463849
KW_VALUES = "VALUES"i !ident_start
38473850
KW_USING = "USING"i !ident_start
38483851

pegjs/mysql.pegjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ set_op
491491
}
492492
/ KW_MINUS { return 'minus' }
493493
/ KW_INTERSECT { return 'intersect' }
494+
/ KW_EXCEPT { return 'except' }
494495

495496
set_op_stmt
496497
= head:select_stmt tail:(__ set_op __ select_stmt)* __ ob: order_by_clause? __ l:limit_clause? {
@@ -4126,6 +4127,7 @@ KW_OVER = "OVER"i !ident_start
41264127
KW_UNION = "UNION"i !ident_start
41274128
KW_MINUS = "MINUS"i !ident_start
41284129
KW_INTERSECT = "INTERSECT"i !ident_start
4130+
KW_EXCEPT = "EXCEPT"i !ident_start
41294131
KW_VALUES = "VALUES"i !ident_start
41304132
KW_USING = "USING"i !ident_start
41314133

test/mysql-mariadb.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,13 @@ describe('mysql', () => {
13331333
"WITH `T` AS (VALUES ROW('foobar')) SELECT * FROM `T`"
13341334
]
13351335
},
1336+
{
1337+
title: 'except clause',
1338+
sql: [
1339+
"SELECT * FROM T1 EXCEPT SELECT * FROM T2",
1340+
"SELECT * FROM `T1` EXCEPT SELECT * FROM `T2`"
1341+
]
1342+
},
13361343
]
13371344
SQL_LIST.forEach(sqlInfo => {
13381345
const { title, sql } = sqlInfo

0 commit comments

Comments
 (0)