You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usage of summed count(*) subqueries (using + operator) has yielded string in versions before @ts-safeql/[email protected], with 3.6.1 this instead yields boolean:
// 💥 Query has incorrect type annotation.// Expected: { employee_count: string; }// Actual: { employee_count: boolean; }[]awaitsql<{employee_count: string}[]>` SELECT ( SELECT count(*) FROM caregivers ) + ( SELECT count(*) FROM caregiver_assistants ) AS employee_count`;
Workaround
Cast the expression to text in the query:
// ✅awaitsql<{employee_count: string}[]>` SELECT ( ( SELECT count(*) FROM caregivers ) + ( SELECT count(*) FROM caregiver_assistants ) )::text AS employee_count`;
To Reproduce
See above
Expected behavior
Inference of string, because pg_typeof() reports bigint, which is a string with Postgres.js
Screenshots
--
Desktop (please complete the following information):
Describe the bug
Usage of summed
count(*)
subqueries (using+
operator) has yieldedstring
in versions before@ts-safeql/[email protected]
, with3.6.1
this instead yieldsboolean
:Workaround
Cast the expression to
text
in the query:To Reproduce
See above
Expected behavior
Inference of
string
, becausepg_typeof()
reportsbigint
, which is a string with Postgres.jsScreenshots
--
Desktop (please complete the following information):
Additional context
Originally introduced in this PR:
The text was updated successfully, but these errors were encountered: