|
7 | 7 |
|
8 | 8 | export type start = multiple_stmt | cmd_stmt | crud_stmt; |
9 | 9 |
|
10 | | -export type cmd_stmt = drop_stmt | create_stmt | truncate_stmt | rename_stmt | call_stmt | use_stmt | alter_stmt | set_stmt | lock_stmt; |
| 10 | +export type cmd_stmt = drop_stmt | create_stmt | truncate_stmt | rename_stmt | call_stmt | use_stmt | alter_stmt | set_stmt | lock_stmt | show_stmt; |
11 | 11 |
|
12 | 12 | export type create_stmt = create_table_stmt | create_constraint_trigger | create_extension_stmt | create_index_stmt | create_sequence | create_db_stmt; |
13 | 13 |
|
@@ -448,6 +448,13 @@ export interface call_stmt_node { |
448 | 448 |
|
449 | 449 | export type call_stmt = AstStatement<call_stmt_node>; |
450 | 450 |
|
| 451 | +export interface show_stmt_node { |
| 452 | + type: 'show'; |
| 453 | + keyword: 'tables'; |
| 454 | + } |
| 455 | + |
| 456 | +export type show_stmt = AstStatement<show_stmt_node>; |
| 457 | + |
451 | 458 | export interface select_stmt_node extends select_stmt_nake { |
452 | 459 | parentheses_symbol: true; |
453 | 460 | } |
@@ -486,7 +493,7 @@ export type array_index = { brackets: boolean, number: number }; |
486 | 493 |
|
487 | 494 | export type expr_item = expr & { array_index: array_index }; |
488 | 495 |
|
489 | | -export type column_list_item = { type: 'cast'; expr: expr; symbol: '::'; target: data_type; as?: null; } | { type: 'star_ref'; expr: column_ref; as: null; } | { type: 'expr'; expr: expr; as?: alias_clause; }; |
| 496 | +export type column_list_item = { expr: expr; as: null; } | { type: 'cast'; expr: expr; symbol: '::'; target: data_type; as?: null; } | { type: 'star_ref'; expr: column_ref; as: null; } | { type: 'expr'; expr: expr; as?: alias_clause; }; |
490 | 497 |
|
491 | 498 |
|
492 | 499 |
|
@@ -547,7 +554,7 @@ export type on_clause = expr; |
547 | 554 |
|
548 | 555 |
|
549 | 556 |
|
550 | | -export type where_clause = expr; |
| 557 | +export type where_clause = binary_expr; |
551 | 558 |
|
552 | 559 |
|
553 | 560 |
|
@@ -656,9 +663,16 @@ export type interval_expr = { type: 'interval', expr: expr; unit: interval_unit; |
656 | 663 |
|
657 | 664 |
|
658 | 665 |
|
| 666 | + |
| 667 | + |
659 | 668 | export type case_expr = { |
660 | 669 | type: 'case'; |
661 | | - expr?: expr; |
| 670 | + expr: null; |
| 671 | + // nb: Only the last element is a case_else |
| 672 | + args: (case_when_then | case_else)[]; |
| 673 | + } | { |
| 674 | + type: 'case'; |
| 675 | + expr: expr; |
662 | 676 | // nb: Only the last element is a case_else |
663 | 677 | args: (case_when_then | case_else)[]; |
664 | 678 | }; |
@@ -696,8 +710,6 @@ export type unary_expr = { |
696 | 710 |
|
697 | 711 | export type or_and_where_expr = binary_expr; |
698 | 712 |
|
699 | | -export type parentheses_or_expr = binary_expr | or_expr; |
700 | | - |
701 | 713 | export type or_expr = binary_expr; |
702 | 714 |
|
703 | 715 | export type and_expr = binary_expr; |
@@ -750,9 +762,11 @@ export type multiplicative_operator = "*" | "/" | "%"; |
750 | 762 |
|
751 | 763 | export type primary = cast_expr | literal | aggr_func | window_func | func_call | case_expr | interval_expr | column_ref | param | expr | binary_expr | expr_list | var_decl | { type: 'origin'; value: string; }; |
752 | 764 |
|
| 765 | +export type string_constants_escape = { type: 'origin'; value: string; }; |
| 766 | + |
753 | 767 |
|
754 | 768 |
|
755 | | -export type column_ref = { |
| 769 | +export type column_ref = string_constants_escape | { |
756 | 770 | type: 'column_ref'; |
757 | 771 | table: ident; |
758 | 772 | column: column | '*'; |
|
0 commit comments