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
Postgres: plugin-storage list/count fail with "operator does not exist: boolean = integer" when filtering #920
When EmDash runs against Postgres, PluginStorage.list() and PluginStorage.count() throw operator does not exist: boolean = integer whenever a where clause is supplied. SQLite is unaffected because it silently coerces booleans to integers.
In practice this surfaces as 500s on plugin admin pages that filter their own storage. The most visible victim is emdash-smtp (the Providers and Logs admin pages both filter), but the bug applies to any plugin that calls list/count with a filter on Postgres.
Reproduction
EmDash 0.9.0, Postgres (Supabase pooler, but any Postgres reproduces it):
conststorage=ctx.storage<MyDoc>('my-collection');awaitstorage.put({id: 'a',name: 'foo'});awaitstorage.list({where: {name: 'foo'}});// throws on Postgresawaitstorage.count({name: 'foo'});// throws on Postgres
Stack tail:
error: operator does not exist: boolean = integer
at … kysely … select \"id\", \"data\", \"created_at\" from \"_plugin_storage\" where … = $N
whereSqlParts already builds a complete boolean SQL expression. Wrapping it in … = 1 works on SQLite (1 = 1 after boolean→int coercion) but Postgres rejects boolean = integer with no implicit cast.
Suggested fix
Drop the wrapper in both spots; pass the joined fragment to where() directly:
Kysely.where() accepts a raw SQL fragment that evaluates to boolean, so this is the idiomatic form and works on both dialects.
Happy to open a PR with the change plus a regression test in the existing dialect-parameterised plugin-storage suite — let me know if that'd be welcome.
Environment
EmDash 0.9.0
Astro 6, @astrojs/vercel, output: 'server'
Postgres via emdash/dbpostgres() driver, Supabase session pooler
Node 22
Workaround
Patch node_modules/emdash/dist/search-*.mjs via patch-package, dropping the same wrapper in both bundled occurrences. Rough but unblocks Postgres deploys until upstream lands.
Fix is up in #1898. Root cause was in core, not emdash-smtp: PluginStorageRepository.query()/count() wrapped the where-predicate in (...) = 1 to fit Kysely's binary expression builder — fine on SQLite (boolean coerces to integer), a hard type error on Postgres. The PR passes the predicate directly as a boolean expression and adds dialect-parity regression tests that run against real Postgres in CI.
Activity
swissky commentedon Jul 9, 2026
Fix is up in #1898. Root cause was in core, not emdash-smtp:
PluginStorageRepository.query()/count()wrapped the where-predicate in(...) = 1to fit Kysely's binary expression builder — fine on SQLite (boolean coerces to integer), a hard type error on Postgres. The PR passes the predicate directly as a boolean expression and adds dialect-parity regression tests that run against real Postgres in CI.fix(core): plugin storage where-filters fail on Postgres with boolean…