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
{{ message }}
Repository navigation
A non-boolean value sent to a boolean column is stored as false #42
The boolean serializer in src/types.js is x => x === true ? 't' : 'f'. When the server reports a parameter as boolean, anything other than the JavaScript value true is sent as f:
awaitsql`insert into t (flag) values (${1})`// stored falseawaitsql`insert into t (flag) values (${'true'})`// stored falseawaitsql`insert into t (flag) values (${'t'})`// stored false
PostgreSQL itself reads 1, 'true', 't', 'yes' and 'on' as true, and rejects input it can't read. Here nothing fails and the opposite value is stored. Strings like 'true' arrive this way from forms, query strings and CSV imports.
Upstream treats this as intended: porsager#858 asked about 't' and was closed with a pointer to the serializer. The README doesn't mention it.
Options:
Send anything that isn't a JS boolean as text, so PostgreSQL applies its own boolean input rules and rejects invalid input.
Or throw for non-boolean values.
Either changes what is stored for code that relies on today's behaviour, so it belongs in a major version or behind the parameter-encoding change discussed in #41.
Available in 4.5.0-rc1 with parameter_types: 'client' (npm install @steadybrew/postgresjs@next). parameter_types: 'warn' reports which of your queries 'client' would send differently; see Parameter types. This stays open until 'client' becomes the default in 5.0.
Activity
feat: add parameter_types: 'warn' to report values the planned 'clien…
feat: serialize values from their JavaScript type with parameter_type…
feat: add parameter_types: 'warn' to report values the planned 'clien…
feat: serialize values from their JavaScript type with parameter_type…
feat: add parameter_types: 'warn' to report values the planned 'clien…
feat: serialize values from their JavaScript type with parameter_type…
feat: serialize values from their JavaScript type with parameter_type…
okomarov commentedon Oct 15, 2026
Available in 4.5.0-rc1 with
parameter_types: 'client'(npm install @steadybrew/postgresjs@next).parameter_types: 'warn'reports which of your queries 'client' would send differently; see Parameter types. This stays open until 'client' becomes the default in 5.0.