Skip to content

Commit

Permalink
Merge pull request #1736 from taozhi8833998/refactor-type-pg
Browse files Browse the repository at this point in the history
refactor: update type definition
  • Loading branch information
taozhi8833998 authored Dec 25, 2023
2 parents 1b05a2c + c19bfb0 commit 81c656f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ast/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,8 @@ export type join_op = 'LEFT JOIN' | 'RIGHT JOIN' | 'FULL JOIN' | 'CROSS JOIN' |

export type table_name = { db?: ident; schema?: ident, table: ident | '*'; };

export type or_and_expr = binary_expr;



export type on_clause = or_and_where_expr;
Expand Down Expand Up @@ -1171,7 +1173,7 @@ export type concat_separator = { keyword: string | null; value: literal_string;



export type distinct_args = { distinct: 'DISTINCT'; expr: expr; orderby?: order_by_clause; parentheses: boolean; separator?: concat_separator; };
export type distinct_args = { distinct: 'DISTINCT'; expr: expr; orderby?: order_by_clause; separator?: concat_separator; };



Expand Down Expand Up @@ -1216,6 +1218,12 @@ export type cast_double_colon = {


export type cast_expr = {
type: 'cast';
expr: or_expr | column_ref | param
| expr;
keyword: 'cast';
...cast_double_colon;
} | {
type: 'cast';
expr: literal | aggr_func | func_call | case_expr | interval_expr | column_ref | param
| expr;
Expand Down
1 change: 1 addition & 0 deletions pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -3124,6 +3124,7 @@ table_name

or_and_expr
= head:expr tail:(__ (KW_AND / KW_OR) __ expr)* {
// => binary_expr
const len = tail.length
let result = head
for (let i = 0; i < len; ++i) {
Expand Down

0 comments on commit 81c656f

Please sign in to comment.