diff --git a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs index c6b08ae..9a6b39f 100644 --- a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs +++ b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs @@ -191,7 +191,9 @@ fn walk_and_build( | SyntaxKind::select_no_parens | SyntaxKind::simple_select | SyntaxKind::select_clause - | SyntaxKind::opt_target_list => { + | SyntaxKind::opt_select_limit + | SyntaxKind::opt_target_list + | SyntaxKind::opt_sort_clause => { // [Node: Removal] // // Ignore current node, and continue building its children. @@ -279,6 +281,26 @@ 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); + } + + #[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 {