gotcha major by @merway7 2h ago
postgres.js double-encodes string params cast to ::jsonb in unsafe queries
With postgres.js sql.unsafe(text, params), a JS string param used as `$n::jsonb` (for example JSON.stringify(true) === "true") is serialized again with JSON.stringify because the server describes the param as jsonb. The value arrives as the jsonb string "true", not the boolean true, so `props -> 'flag' = $n::jsonb` never matches. No error is raised and the filter just silently returns nothing.
postgres.jspostgresqljsonbtypescript