Skip to content

fix: support found defects in UNWIND query forms - BED-8324#83

Open
zinic wants to merge 3 commits into
SpecterOps:mainfrom
zinic:main
Open

fix: support found defects in UNWIND query forms - BED-8324#83
zinic wants to merge 3 commits into
SpecterOps:mainfrom
zinic:main

Conversation

@zinic
Copy link
Copy Markdown
Contributor

@zinic zinic commented May 19, 2026

Description

Fixes two PostgreSQL Cypher translation issues:

  • Supports aggregate function calls embedded inside operator expressions, such as count(n) + count(n), count(n) * 2, grouped expressions combined with aggregates, and aggregate expressions projected through WITH.
  • Resolves final projection alias handling for ORDER BY, including UNWIND labels(n) aggregation forms like:
  • RETURN label, count(n) AS count
  • ORDER BY count DESC
  • ORDER BY label
  • RETURN label AS kind ... ORDER BY kind

This also adds integration and translation coverage for the affected query shapes and validates result key/row shape for the label aggregation queries.

Resolves: BED-8324

Type of Change

  • Chore (a change that does not modify the application functionality)
  • Bug fix (a change that fixes an issue)
  • New feature / enhancement (a change that adds new functionality)
  • Refactor (no behaviour change)
  • Test coverage
  • Build / CI / tooling
  • Documentation

Testing

  • Unit tests added / updated
  • Integration tests added / updated
  • Full test suite run (make test_all with CONNECTION_STRING set)

Validated with:

  • CONNECTION_STRING='postgres://postgres:bhe4eva@localhost/bhe' make test_pg
  • CONNECTION_STRING='neo4j://neo4j:neo4jj@localhost:7687' make test_neo4j
  • Focused PostgreSQL integration tests for the UNWIND labels(n) query forms
  • Focused Neo4j integration test for ORDER BY label
  • PostgreSQL translation fixture tests for aggregate operator projections and projection-alias ordering

Screenshots (if appropriate):

N/A

Driver Impact

  • PostgreSQL driver (drivers/pg)
  • Neo4j driver (drivers/neo4j)

Checklist

  • Code is formatted
  • All existing tests pass
  • go.mod / go.sum are up to date if dependencies changed

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Warning

Rate limit exceeded

@zinic has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 53 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7ca3d15d-16a0-41f4-ac8f-2c536ebe315d

📥 Commits

Reviewing files that changed from the base of the PR and between 1ce8c88 and 90dc09e.

📒 Files selected for processing (20)
  • cypher/Cypher Syntax Support.md
  • cypher/models/cypher/functions.go
  • cypher/models/pgsql/pgtypes.go
  • cypher/models/pgsql/pytypes_test.go
  • cypher/models/pgsql/test/translation_cases/multipart.sql
  • cypher/models/pgsql/test/translation_cases/nodes.sql
  • cypher/models/pgsql/test/translation_cases/pattern_binding.sql
  • cypher/models/pgsql/test/translation_cases/scalar_aggregation.sql
  • cypher/models/pgsql/test/translation_cases/unwind.sql
  • cypher/models/pgsql/test/translation_test.go
  • cypher/models/pgsql/translate/function.go
  • cypher/models/pgsql/translate/model.go
  • cypher/models/pgsql/translate/projection.go
  • cypher/models/pgsql/translate/translator.go
  • cypher/models/pgsql/translate/with.go
  • integration/cypher_test.go
  • integration/testdata/cases/aggregation_inline.json
  • integration/testdata/cases/nodes_inline.json
  • integration/testdata/cases/pattern_binding_inline.json
  • integration/testdata/cases/unwind_inline.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zinic zinic changed the title fix(pgsql): support aggregate operator projections fix: support found defects in UNWIND query forms - BED-8324 May 20, 2026
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