From aafb3bf7f700a3a100a1c50e3c6e87514a1bdc09 Mon Sep 17 00:00:00 2001 From: Taishi Naka Date: Mon, 31 Mar 2025 16:10:58 +0900 Subject: [PATCH 1/2] change(tree-sitter module): remove opt_select_limit --- .../postgresql-cst-parser/src/tree_sitter/convert.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs index c6b08ae..0898156 100644 --- a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs +++ b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs @@ -191,6 +191,7 @@ fn walk_and_build( | SyntaxKind::select_no_parens | SyntaxKind::simple_select | SyntaxKind::select_clause + | SyntaxKind::opt_select_limit | SyntaxKind::opt_target_list => { // [Node: Removal] // @@ -279,6 +280,16 @@ FROM let (new_root, _) = get_ts_tree_and_range_map(input, &root); assert_not_exists(&new_root, SyntaxKind::opt_target_list); } + + #[test] + fn no_opt_select_limit() { + let input = "select a from t for update limit 5 offset 5;"; + let root = cst::parse(input).unwrap(); + assert_exists(&root, SyntaxKind::opt_select_limit); + + let (new_root, _) = get_ts_tree_and_range_map(input, &root); + assert_not_exists(&new_root, SyntaxKind::opt_select_limit); + } } mod flatten { From 822b9b881b62cbd9cd111664bf01ae9b98bea851 Mon Sep 17 00:00:00 2001 From: Taishi Naka Date: Mon, 31 Mar 2025 17:09:05 +0900 Subject: [PATCH 2/2] change(tree-sitter module): remove opt_sort_clause --- .../src/tree_sitter/convert.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs index 0898156..9a6b39f 100644 --- a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs +++ b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs @@ -192,7 +192,8 @@ fn walk_and_build( | SyntaxKind::simple_select | SyntaxKind::select_clause | SyntaxKind::opt_select_limit - | SyntaxKind::opt_target_list => { + | SyntaxKind::opt_target_list + | SyntaxKind::opt_sort_clause => { // [Node: Removal] // // Ignore current node, and continue building its children. @@ -290,6 +291,16 @@ FROM let (new_root, _) = get_ts_tree_and_range_map(input, &root); assert_not_exists(&new_root, SyntaxKind::opt_select_limit); } + + #[test] + fn no_opt_sort_clause() { + let input = "select a from t order by a desc limit 5;"; + let root = cst::parse(input).unwrap(); + assert_exists(&root, SyntaxKind::opt_sort_clause); + + let (new_root, _) = get_ts_tree_and_range_map(input, &root); + assert_not_exists(&new_root, SyntaxKind::opt_sort_clause); + } } mod flatten {