From ee5975d776c8dfd0e0bbb6e6144531b43d4c1d6a Mon Sep 17 00:00:00 2001 From: Peter Amiri Date: Tue, 4 Aug 2026 21:27:32 -0700 Subject: [PATCH] test(model): use non-aggregate terminals in forUpdate chain specs 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. Co-Authored-By: Claude Fable 5 Signed-off-by: Peter Amiri --- vendor/wheels/tests/specs/model/queryBuilderSpec.cfc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vendor/wheels/tests/specs/model/queryBuilderSpec.cfc b/vendor/wheels/tests/specs/model/queryBuilderSpec.cfc index c8c0ab886..636063472 100644 --- a/vendor/wheels/tests/specs/model/queryBuilderSpec.cfc +++ b/vendor/wheels/tests/specs/model/queryBuilderSpec.cfc @@ -279,11 +279,12 @@ component extends="wheels.WheelsTest" { it("forUpdate() starts a chain", () => { // FOR UPDATE is a no-op on SQLite/MSSQL; this pins the chain-entry dispatch, not the locking. + // Terminal must be non-aggregate: Postgres/CockroachDB reject COUNT(*) ... FOR UPDATE. var result = model("author") .forUpdate() .where("lastName", "Djurner") - .count(); - expect(result).toBe(1); + .get(); + expect(result.recordcount).toBe(1); }) }) @@ -291,11 +292,12 @@ component extends="wheels.WheelsTest" { describe("scope chain to builder transition", () => { it("forUpdate() transitions from a scope chain to the query builder", () => { + // Non-aggregate terminal for the same Postgres/CockroachDB FOR UPDATE restriction. var result = model("authorScoped") .withLastNameDjurner() .forUpdate() - .count(); - expect(result).toBe(1); + .get(); + expect(result.recordcount).toBe(1); }) })