Skip to content

Commit 11952f3

Browse files
bpamiriPeter Amiriclaude
authored
test(model): use non-aggregate terminals in forUpdate chain specs (#3375)
The two forUpdate() chain-entry specs added by PR #3368 used .count() as the terminal. Postgres and CockroachDB reject aggregate functions combined with FOR UPDATE, so every postgres/cockroachdb leg in the compat matrix failed with 'FOR UPDATE is not allowed with aggregate functions'. The specs pin chain-entry dispatch, not locking semantics, so a non-aggregate .get() terminal asserts the same behavior on every engine. Verified locally on lucee7 + cockroachdb (previously failing leg): 4775 pass / 0 fail / 0 error; lucee7 + sqlite: 4763 pass / 0 fail / 0 error. Signed-off-by: Peter Amiri <petera@pai.com> Co-authored-by: Peter Amiri <petera@pai.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 3b7199c commit 11952f3

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

vendor/wheels/tests/specs/model/queryBuilderSpec.cfc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,23 +279,25 @@ component extends="wheels.WheelsTest" {
279279

280280
it("forUpdate() starts a chain", () => {
281281
// FOR UPDATE is a no-op on SQLite/MSSQL; this pins the chain-entry dispatch, not the locking.
282+
// Terminal must be non-aggregate: Postgres/CockroachDB reject COUNT(*) ... FOR UPDATE.
282283
var result = model("author")
283284
.forUpdate()
284285
.where("lastName", "Djurner")
285-
.count();
286-
expect(result).toBe(1);
286+
.get();
287+
expect(result.recordcount).toBe(1);
287288
})
288289

289290
})
290291

291292
describe("scope chain to builder transition", () => {
292293

293294
it("forUpdate() transitions from a scope chain to the query builder", () => {
295+
// Non-aggregate terminal for the same Postgres/CockroachDB FOR UPDATE restriction.
294296
var result = model("authorScoped")
295297
.withLastNameDjurner()
296298
.forUpdate()
297-
.count();
298-
expect(result).toBe(1);
299+
.get();
300+
expect(result.recordcount).toBe(1);
299301
})
300302

301303
})

0 commit comments

Comments
 (0)