The test database that lied · figure 1
One statement, two dialects
The same SQLAlchemy statement leaves with_for_update_if_supported as two different queries — and only one of them ever ran in CI.
or click either path
select(func.count()).where(owner_filter)
one SQLAlchemy statement
with_for_update_if_supported
which dialect?
sqlite+aiosqlite:///:memory:
helper early-returns the bare statement
SELECT count(*) …
no lock — _for_update_arg = None
✓ tests pass
PostgreSQL via asyncpg
helper attaches the lock
SELECT count(*) … FOR UPDATE OF workspaces
FeatureNotSupportedError
“FOR UPDATE is not allowed with aggregate function”
→ HTTP 500