Skip to content

Commit 5369058

Browse files
committed
refactor: upgrade version
1 parent 05a4252 commit 5369058

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

ast/postgresql.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export type create_view_stmt_t = {
7373
recursive?: 'recursive',
7474
view: table_name,
7575
columns?: column_list,
76-
select: select_stmt_nake,
76+
select: select_stmt,
7777
with_options?: with_view_options,
7878
with?: string,
7979
}
@@ -316,17 +316,17 @@ export type create_column_definition = {
316316
resource: 'column';
317317
};
318318

319-
export type column_constraint = { nullable: literal_null | literal_not_null; default_val: default_expr; };
319+
export type column_constraint = { constraint: constraint_name; } | { nullable: literal_null | literal_not_null; default_val: default_expr; };
320320

321321
export type collate_expr = { type: 'collate'; keyword: 'collate'; collate: { symbol: '=' ; name: ident_type; value: ident_type; }} | { type: 'collate'; keyword: 'collate'; collate: { symbol: '=' | null ; name: ident_type; }};
322322

323323
export type column_format = { type: 'column_format'; value: 'fixed' | 'dynamic' | 'default'; };
324324

325325
export type storage = { type: 'storage'; value: 'disk' | 'memory' };
326326

327-
export type default_arg_expr = { type: 'default'; keyword: string, value: literal | expr; };
327+
export type default_arg_expr = { type: 'default'; keyword: string, value: expr; };
328328

329-
export type default_expr = { type: 'default'; value: literal | expr; };
329+
export type default_expr = { type: 'default'; value: expr; };
330330

331331
export type drop_index_opt = (ALTER_ALGORITHM | ALTER_LOCK)[];
332332

@@ -876,7 +876,7 @@ export type expr_item = binary_column_expr & { array_index: array_index };
876876

877877
export type cast_data_type = data_type & { quoted?: string };
878878

879-
export type column_list_item = { expr: expr; as: null; } | { type: 'cast'; expr: expr; symbol: '::'; target: cast_data_type; as?: null; jsonb?: jsonb_or_json_op_right[]; } | { expr: column_ref; as: null; } | { type: 'expr'; expr: expr; as?: alias_clause; };
879+
export type column_list_item = { expr: expr; as: null; } | { type: 'cast'; expr: expr; symbol: '::'; target: cast_data_type; as?: null; } | { expr: column_ref; as: null; } | { type: 'expr'; expr: expr; as?: alias_clause; };
880880

881881

882882

@@ -1152,7 +1152,7 @@ export type exists_expr = unary_expr;
11521152

11531153
export type exists_op = 'NOT EXISTS' | KW_EXISTS;
11541154

1155-
export type comparison_op_right = arithmetic_op_right | in_op_right | between_op_right | is_op_right | like_op_right | jsonb_or_json_op_right | regex_op_right;
1155+
export type comparison_op_right = arithmetic_op_right | in_op_right | between_op_right | is_op_right | like_op_right | regex_op_right;
11561156

11571157
export type arithmetic_op_right = { type: 'arithmetic'; tail: any };
11581158

@@ -1184,8 +1184,6 @@ export type like_op_right = { op: like_op; right: (literal | comparison_expr) &
11841184

11851185
export type in_op_right = {op: in_op; right: expr_list | var_decl | literal_string; };
11861186

1187-
export type jsonb_or_json_op_right = { op: string; right: { type: 'expr'; expr: expr_item } };
1188-
11891187
export type additive_expr = binary_expr;
11901188

11911189
export type additive_operator = "+" | "-";
@@ -1198,10 +1196,12 @@ export type column_ref_array_index = column_ref;
11981196

11991197
export type primary = cast_expr | or_and_where_expr | var_decl | { type: 'origin'; value: string; };
12001198

1201-
export type unary_expr_or_primary = primary | unary_expr;
1199+
export type unary_expr_or_primary = jsonb_expr | unary_expr;
12021200

12031201
export type unary_operator = "!" | "-" | "+" | "~";
12041202

1203+
export type jsonb_expr = binary_expr | primary | binary_expr;
1204+
12051205
export type string_constants_escape = { type: 'origin'; value: string; };
12061206

12071207

@@ -1213,7 +1213,6 @@ export type column_ref = string_constants_escape | {
12131213
schema: string;
12141214
table: string;
12151215
column: column | '*';
1216-
jsonb?: jsonb_or_json_op_right[];
12171216
} | {
12181217
type: 'column_ref';
12191218
table: ident;
@@ -1342,7 +1341,6 @@ export type cast_double_colon = {
13421341
as?: alias_clause,
13431342
symbol: '::' | 'as',
13441343
target: data_type;
1345-
jsonb?: jsonb_or_json_op_right[];
13461344
};
13471345

13481346

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-sql-parser",
3-
"version": "5.3.0",
3+
"version": "5.3.1",
44
"description": "simple node sql parser",
55
"main": "index.js",
66
"types": "types.d.ts",

pegjs/postgresql.pegjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@ create_column_definition
13461346

13471347
column_constraint
13481348
= n:constraint_name {
1349+
// => { constraint: constraint_name; }
13491350
return { constraint: n }
13501351
}
13511352
/ n:(literal_not_null / literal_null) __ df:default_expr? {

0 commit comments

Comments
 (0)