Skip to content

Conversation

@levkk
Copy link
Collaborator

@levkk levkk commented Dec 7, 2025

Refactor the query parser to be completely recursive. Use the same parser for SELECT and DELETE queries. This adds support for extracting the sharding key filter from pretty much anywhere in the query, as long as it follows our supported format:

key = $1 OR key IN ($1, $2, $3) OR key = ANY($1)

fix #653

TODOs:

  1. Use new parser for UPDATE and INSERT statements. Requires integration with Query rewrite engine 3.0 (part 1 of many) #637 (split rewrite engine from parser).

@codecov
Copy link

codecov bot commented Dec 7, 2025

Codecov Report

❌ Patch coverage is 91.92340% with 97 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pgdog/src/frontend/router/parser/statement.rs 91.83% 89 Missing ⚠️
pgdog/src/frontend/router/parser/column.rs 84.00% 4 Missing ⚠️
pgdog/src/frontend/router/parser/table.rs 40.00% 3 Missing ⚠️
pgdog/src/backend/replication/sharded_tables.rs 95.45% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@levkk levkk force-pushed the levkk-fix-subqueries branch from 07e61f7 to 947713d Compare December 8, 2025 14:41
@levkk levkk changed the title Fix subqueries feat: support subqueries for shard selection Dec 8, 2025
@blacksmith-sh
Copy link
Contributor

blacksmith-sh bot commented Dec 8, 2025

Found 3 test failures on Blacksmith runners:

Failures

Test View Logs
unbans all pools View Logs
connection/tcp broken database both down unbans all pools View Logs
crud_spec/CRUD and Join for Customer and Order does full CRUD and join View Logs

Fix in Cursor

@levkk levkk marked this pull request as ready for review December 8, 2025 15:05
@levkk levkk merged commit 2b431c7 into main Dec 8, 2025
6 of 7 checks passed
@levkk levkk deleted the levkk-fix-subqueries branch December 8, 2025 15:06
levkk added a commit that referenced this pull request Dec 8, 2025
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.

[Query engine] Support finding sharding key in subquery

2 participants