Skip to content

fix: parse PostgreSQL VARIADIC function arguments (7002) - #4246

Open
benfdking wants to merge 1 commit into
port/sqlfluff-7001from
port/sqlfluff-7002
Open

benfdking wants to merge 1 commit into
port/sqlfluff-7001from
port/sqlfluff-7002

Conversation

@benfdking

Copy link
Copy Markdown
Collaborator

Stacked on sqruff #4245. Merge #4245 first.
#4245

Summary

  • Parse PostgreSQL VARIADIC function-call arguments as general expressions, including nested functions and ARRAY subqueries.
  • Port all four upstream regression queries and matching parse trees; existing variadic array-literal behavior remains covered.

Ported from SQLFluff b8f99fd9d4acb2a9df139f183df7025fef4906aa
sqlfluff/sqlfluff#7002
sqlfluff/sqlfluff@b8f99fd

Validation

  • cargo fmt --all -- --check
  • cargo build
  • cargo test
  • bazel test //... --test_timeout=600,300,900,3600 --local_test_jobs=1 --lockfile_mode=off

Ported from SQLFluff b8f99fd9d4acb2a9df139f183df7025fef4906aa
sqlfluff/sqlfluff#7002
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-15T12:09:25.491552Z 3012324 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@benfdking
benfdking added this pull request to stack #4155 September 15, 2026 12:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3012324a41

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +9174 to +9177
Sequence::new(vec![
Ref::keyword("VARIADIC").to_matchable(),
Ref::new("ExpressionSegment").to_matchable(),
])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include VARIADIC expressions in delimited argument lists

When a general variadic expression follows one or more fixed arguments, such as concat_ws(',', VARIADIC make_values()), this alternative cannot be reached because it is only a top-level FunctionContentsGrammar element; the existing delimited argument matcher stops when the reserved VARIADIC token cannot start an ExpressionSegment. The added multi-argument fixture passes only because VARIADIC ARRAY[...] is already consumed as a TypedArrayLiteralSegment. Add the variadic form to the delimited argument alternatives so PostgreSQL's valid fixed-arguments-plus-variadic-expression form parses.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark for 905d197

Click to view benchmark
Test Base PR %
DepthMap::from_parent 115.2±1.69µs 119.4±1.22µs +3.65%
fix_complex_query 25.7±0.49ms 25.6±0.41ms -0.39%
fix_superlong 83.2±6.80ms 81.0±6.48ms -2.64%
parse_complex_query 4.1±0.06µs 4.0±0.06µs -2.44%
parse_expression_recursion 6.8±0.10µs 6.8±0.09µs 0.00%
parse_simple_query 1019.4±28.26ns 1042.0±16.82ns +2.22%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant