PgDog version
v0.1.48
Description
Cross-shard aggregates are not returned correctly when aggregate functions are mixed with columns, e.g.:
SELECT org_id, id, extra, max(val) FROM t GROUP BY org_id, id;
Which returns multiple rows:
org_id | id | extra | max
2 | 1 | | 20
3 | 1 | | 30
1 | 1 | | 10
Logs
Attach trace logs, if the issue can be reproduced locally. To get trace logs, set RUST_LOG=trace, e.g.:
2026-07-09T20:18:11.984124Z DEBUG SELECT org_id, id, extra, max(val) FROM t GROUP BY org_id, id;
2026-07-09T20:18:11.984145Z DEBUG table is sharded, but no sharding key detected
2026-07-09T20:18:11.984151Z DEBUG query router decision: Query(
Route {
shard: ShardWithPriority {
source: Table(
Sharded,
),
shard: All,
},
read: true,
order_by: [],
aggregate: Aggregate {
targets: [
AggregateTarget {
column: 3,
function: Max,
distinct: false,
},
],
group_by: [
0,
1,
],
},
limit: Limit {
limit: None,
offset: None,
},
advisory_locks: AdvisoryLocks {
locks: {},
},
distinct: None,
rewrite_plan: AggregateRewritePlan {
helpers: [],
},
explain: None,
rollback_savepoint: false,
search_path_driven: false,
schema_changed: false,
omnisharded: false,
},
)
Configuration
Sharded config with matching tables.
PgDog version
v0.1.48Description
Cross-shard aggregates are not returned correctly when aggregate functions are mixed with columns, e.g.:
Which returns multiple rows:
Logs
Attach trace logs, if the issue can be reproduced locally. To get trace logs, set
RUST_LOG=trace, e.g.:2026-07-09T20:18:11.984124Z DEBUG SELECT org_id, id, extra, max(val) FROM t GROUP BY org_id, id; 2026-07-09T20:18:11.984145Z DEBUG table is sharded, but no sharding key detected 2026-07-09T20:18:11.984151Z DEBUG query router decision: Query( Route { shard: ShardWithPriority { source: Table( Sharded, ), shard: All, }, read: true, order_by: [], aggregate: Aggregate { targets: [ AggregateTarget { column: 3, function: Max, distinct: false, }, ], group_by: [ 0, 1, ], }, limit: Limit { limit: None, offset: None, }, advisory_locks: AdvisoryLocks { locks: {}, }, distinct: None, rewrite_plan: AggregateRewritePlan { helpers: [], }, explain: None, rollback_savepoint: false, search_path_driven: false, schema_changed: false, omnisharded: false, }, )Configuration
Sharded config with matching tables.