From: murex971 (@murex971) <noreply+murex971@github.com>
To: pgdogdev/pgdog <noreply+pgdogdev-pgdog@github.com>
Subject: [pgdogdev/pgdog] PR #2030: fix(cross-shard): compute LIMIT/OFFSET with integer arithmetic and casts
Date: Fri, 13 Nov 2026 08:40:09 +0000
Message-ID: <gh-pgdogdev-pgdog-2030@github.com> (raw)
### Problem
Cross-shard `GROUP BY` with aggregates or `HAVING` rejected
`LIMIT 1 + 1` and `LIMIT $1::int` with `0A000`.
### Fix
`LimitClause` computes integer arithmetic (`+ - * `, unary `-`/`+`) and
casts to `int2`/`int4`/`int8` over literals and parameters. A cast
fails when the value doesn't fit the type. `NULL` anywhere means no limit,
as in Postgres.
Still rejected with `0A000`: functions, subqueries, decimal literals,
non-integer casts, and simple-protocol `PREPARE`/`EXECUTE` with an
expression.