Skip to content

Commit 4025662

Browse files
committed
refactor: upgrade version
1 parent e6412e1 commit 4025662

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

ast/postgresql.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,15 @@ export interface drop_index_stmt_node {
349349
options?: 'cascade' | 'restrict';
350350
}
351351

352-
export type drop_stmt = AstStatement<drop_stmt_node> | AstStatement<drop_index_stmt_node>;
352+
export interface drop_view_stmt_node {
353+
type: 'drop';
354+
prefix?: string;
355+
keyword: 'view';
356+
name: table_ref_list;
357+
options?: view_options;
358+
}
359+
360+
export type drop_stmt = AstStatement<drop_stmt_node> | AstStatement<drop_index_stmt_node> | AstStatement<drop_view_stmt_node>;
353361

354362
export type truncate_table_name = table_name & { suffix?: string };
355363

@@ -609,6 +617,8 @@ export type reference_definition = {
609617

610618
export type on_reference = { type: 'on delete' | 'on update'; value: reference_option; };
611619

620+
export type view_options = 'restrict' | 'cascade';;
621+
612622
export type reference_option = { type: 'function'; name: string; args: expr_list; } | 'restrict' | 'cascade' | 'set null' | 'no action' | 'set default' | 'current_timestamp';
613623

614624

@@ -1359,7 +1369,13 @@ export type tablefunc_clause = { type: 'tablefunc'; name: proc_func_name; args:
13591369

13601370
export type substring_funcs_clause = { type: 'function'; name: 'substring'; args: expr_list; };
13611371

1362-
export type func_call = trim_func_clause | tablefunc_clause | substring_funcs_clause | { type: 'function'; name: proc_func_name; args: expr_list; suffix: literal_string; } | { type: 'function'; name: proc_func_name; args: expr_list; over?: over_partition; } | extract_func | { type: 'function'; name: proc_func_name; over?: on_update_current_timestamp; } | { type: 'function'; name: proc_func_name; args: expr_list; };
1372+
export type make_interval_func_args_item = { type: 'func_arg', value: { name: ident_name; symbol: '=>', value: literal_numeric; } };
1373+
1374+
export type make_interval_func_args = make_interval_func_args_item[] | expr_list;
1375+
1376+
export type make_interval_func_clause = { type: 'function'; name: proc_func_name; args: make_interval_func_args; };
1377+
1378+
export type func_call = trim_func_clause | tablefunc_clause | substring_funcs_clause | make_interval_func_clause | { type: 'function'; name: proc_func_name; args: expr_list; suffix: literal_string; } | { type: 'function'; name: proc_func_name; args: expr_list; over?: over_partition; } | extract_func | { type: 'function'; name: proc_func_name; over?: on_update_current_timestamp; } | { type: 'function'; name: proc_func_name; args: expr_list; };
13631379

13641380
export type extract_filed = 'string';
13651381

@@ -1432,6 +1448,10 @@ export type line_terminator = string;
14321448

14331449
export type literal_numeric = number | { type: 'bigint'; value: string; };
14341450

1451+
type integer = never;
1452+
1453+
type double_float = never;
1454+
14351455
export type int = string;
14361456

14371457
export type frac = string;
@@ -1975,6 +1995,8 @@ export type enum_type = data_type;
19751995

19761996
export type json_type = data_type;
19771997

1998+
export type geometry_type_args = { length: string, scale?: number | null };
1999+
19782000

19792001

19802002
export type geometry_type = data_type;

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.6",
3+
"version": "5.3.7",
44
"description": "simple node sql parser",
55
"main": "index.js",
66
"types": "types.d.ts",

pegjs/postgresql.pegjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5390,6 +5390,7 @@ integer
53905390
}
53915391
double_float
53925392
= int_:int? frac:frac exp:exp {
5393+
// => IGNORE
53935394
const numStr = (int_ || '') + frac + exp
53945395
return {
53955396
type: 'bigint',
@@ -6052,6 +6053,7 @@ json_type
60526053

60536054
geometry_type_args
60546055
= t:('POINT'i / 'LINESTRING'i / 'POLYGON'i / 'MULTIPOINT'i / 'MULTILINESTRING'i / 'MULTIPOLYGON'i / 'GEOMETRYCOLLECTION'i) __ srid:(COMMA __ [0-9]+)? {
6056+
// => { length: string, scale?: number | null }
60556057
return {
60566058
length: t,
60576059
scale: srid && srid[2] && parseInt(srid[2].join(''), 10)

0 commit comments

Comments
 (0)