Skip to content

Commit 638d2c3

Browse files
Merge branch 'master' into sgress454/allow-string-concat-in-like
2 parents 250b742 + 71372ff commit 638d2c3

15 files changed

Lines changed: 78 additions & 71 deletions

.babelrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@
1313
"debug": false
1414
}
1515
]
16-
],
17-
"plugins": [
18-
"@babel/plugin-proposal-object-rest-spread"
1916
]
20-
}
17+
}

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
],
8383
"max-len": 0,
8484
"prefer-arrow-callback": 2,
85+
"prefer-object-spread": "error",
8586
"arrow-spacing": [
8687
2,
8788
{
@@ -138,4 +139,4 @@
138139
"no-process-env": 0,
139140
"default-case": 0
140141
}
141-
}
142+
}

ast/postgresql.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ export type create_table_definition = create_definition[];
284284

285285
export type create_definition = create_column_definition | create_index_definition | create_fulltext_spatial_index_definition | create_constraint_definition;
286286

287-
export type column_definition_opt = column_constraint | { auto_increment: 'auto_increment'; } | { unique: 'unique' | 'unique key'; } | { unique: 'key' | 'primary key'; } | { comment: keyword_comment; } | { collate: collate_expr; } | { column_format: column_format; } | { storage: storage } | { reference_definition: reference_definition; } | { check: check_constraint_definition; } | { character_set: { type: 'CHARACTER SET'; symbol: '=' | null; value: ident_without_kw_type; } };
287+
export type column_definition_opt = column_constraint | { auto_increment: 'auto_increment'; } | { unique: 'unique' | 'unique key'; } | { unique: 'key' | 'primary key'; } | { comment: keyword_comment; } | { generated_by_default: { type: 'origin', value: string } } | { collate: collate_expr; } | { column_format: column_format; } | { storage: storage } | { reference_definition: reference_definition; } | { check: check_constraint_definition; } | { character_set: { type: 'CHARACTER SET'; symbol: '=' | null; value: ident_without_kw_type; } };
288288

289289

290290

@@ -1719,6 +1719,8 @@ type KW_SMALLINT = never;
17191719

17201720
type KW_SERIAL = never;
17211721

1722+
type KW_SMALLSERIAL = never;
1723+
17221724
type KW_TINYINT = never;
17231725

17241726
type KW_TINYTEXT = never;

package-lock.json

Lines changed: 2 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-sql-parser",
3-
"version": "5.3.11",
3+
"version": "5.3.12",
44
"description": "simple node sql parser",
55
"main": "index.js",
66
"types": "types.d.ts",
@@ -56,7 +56,6 @@
5656
"devDependencies": {
5757
"@babel/cli": "^7.5.5",
5858
"@babel/core": "^7.10.5",
59-
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
6059
"@babel/preset-env": "^7.10.4",
6160
"@babel/register": "^7.10.5",
6261
"@types/chai": "^4.1.7",

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: 3 additions & 1 deletion
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? {
@@ -2289,7 +2290,7 @@ with_clause
22892290
}
22902291

22912292
cte_definition
2292-
= name:(literal_string / ident_name / table_name) __ columns:cte_column_definition? __ KW_AS __ LPAREN __ stmt:set_op_stmt __ RPAREN {
2293+
= name:(literal_string / ident_name / table_name) __ columns:cte_column_definition? __ KW_AS __ LPAREN __ stmt:(value_clause / set_op_stmt) __ RPAREN {
22932294
if (typeof name === 'string') name = { type: 'default', value: name }
22942295
if (name.table) name = { type: 'default', value: name.table }
22952296
return { name, stmt, columns };
@@ -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

pegjs/snowflake.pegjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2504,7 +2504,7 @@ table_base
25042504
// => table_name & { as?: alias_clause; }
25052505
if (t.type === 'var') {
25062506
t.as = alias;
2507-
Object.assign(t, {...getLocationObject()})
2507+
t = { ...t, ...getLocationObject() }
25082508
return t;
25092509
} else {
25102510
return {

pegjs/sqlite.pegjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2427,7 +2427,7 @@ over_partition
24272427
}
24282428
/ on_update_current_timestamp
24292429
aggr_fun_count
2430-
= name:KW_COUNT __ LPAREN __ arg:count_arg __ RPAREN __ bc:over_partition? {
2430+
= name:(KW_COUNT / KW_GROUP_CONCAT) __ LPAREN __ arg:count_arg __ RPAREN __ bc:over_partition? {
24312431
return {
24322432
type: 'aggr_func',
24332433
name: name,
@@ -2805,6 +2805,7 @@ KW_AND = "AND"i !ident_start { return 'AND'; }
28052805
KW_OR = "OR"i !ident_start { return 'OR'; }
28062806

28072807
KW_COUNT = "COUNT"i !ident_start { return 'COUNT'; }
2808+
KW_GROUP_CONCAT = "GROUP_CONCAT"i !ident_start { return 'GROUP_CONCAT'; }
28082809
KW_MAX = "MAX"i !ident_start { return 'MAX'; }
28092810
KW_MIN = "MIN"i !ident_start { return 'MIN'; }
28102811
KW_SUM = "SUM"i !ident_start { return 'SUM'; }

pegjs/trino.pegjs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
'RENAME': true,
6767
// 'REPLACE': true,
6868
'RIGHT': true,
69+
'ROW': true,
6970
'ROWS': true,
7071

7172
'SELECT': true,
@@ -2470,7 +2471,7 @@ table_base
24702471
// => table_name & { as?: alias_clause; }
24712472
if (t.type === 'var') {
24722473
t.as = alias;
2473-
Object.assign(t, {...getLocationObject()})
2474+
t = { ...t, ...getLocationObject() }
24742475
return t;
24752476
} else {
24762477
return {
@@ -3073,6 +3074,21 @@ case_else = KW_ELSE __ result:expr {
30733074
return { type: 'else', result: result };
30743075
}
30753076

3077+
row_value_list
3078+
= head:column_list_item tail:(__ COMMA __ column_list_item)* {
3079+
// => column_list_item[]
3080+
return createList(head, tail);
3081+
}
3082+
3083+
row_expr
3084+
= KW_ROW __ LPAREN __ l:row_value_list __ RPAREN {
3085+
// => { type: 'row_constructor', value: row_value_list }
3086+
return {
3087+
type: 'struct',
3088+
keyword: 'row',
3089+
expr_list: l
3090+
};
3091+
}
30763092
/**
30773093
* Borrowed from PL/SQL ,the priority of below list IS ORDER BY DESC
30783094
* ---------------------------------------------------------------------------------------------------
@@ -3347,6 +3363,7 @@ column_ref_array_index
33473363
}
33483364
primary
33493365
= cast_expr
3366+
/ row_expr
33503367
/ LPAREN __ list:or_and_where_expr __ RPAREN {
33513368
// => or_and_where_expr
33523369
list.parentheses = true;
@@ -4396,6 +4413,7 @@ KW_BIGSERIAL = "BIGSERIAL"i !ident_start { return 'BIGSERIAL'; }
43964413
KW_REAL = "REAL"i !ident_start { return 'REAL'; }
43974414
KW_DATE = "DATE"i !ident_start { return 'DATE'; }
43984415
KW_DATETIME = "DATETIME"i !ident_start { return 'DATETIME'; }
4416+
KW_ROW = "ROW"i !ident_start { return 'ROW'; }
43994417
KW_ROWS = "ROWS"i !ident_start { return 'ROWS'; }
44004418
KW_TIME = "TIME"i !ident_start { return 'TIME'; }
44014419
KW_TIMESTAMP= "TIMESTAMP"i!ident_start { return 'TIMESTAMP'; }

0 commit comments

Comments
 (0)