From fc828f0bfa100635fcf75c14904733e69cb36ec9 Mon Sep 17 00:00:00 2001 From: Taishi Naka Date: Thu, 27 Mar 2025 17:34:22 +0900 Subject: [PATCH] flatten groupby_list --- .../postgresql-cst-parser/src/tree_sitter/convert.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs index bbacc72..bf5a1e5 100644 --- a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs +++ b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs @@ -144,6 +144,7 @@ fn walk_and_build( | SyntaxKind::expr_list | SyntaxKind::func_arg_list | SyntaxKind::when_clause_list + | SyntaxKind::group_by_list | SyntaxKind::sortby_list) => { if parent_kind == child_kind { // [Node: Flatten] @@ -363,5 +364,14 @@ FROM assert_no_direct_nested_kind(&new_root, SyntaxKind::sortby_list); } + + #[test] + fn no_nested_groupby_list() { + let input = "select a, b, c from t group by a, b, c;"; + let root = cst::parse(input).unwrap(); + let (new_root, _) = get_ts_tree_and_range_map(&input, &root); + + assert_no_direct_nested_kind(&new_root, SyntaxKind::group_by_list); + } } }