knex/knex · error · Error
Json superset is not supported by Redshift
Error message
Json superset is not supported by Redshift
What it means
redshift-querycompiler.js:150 stubs whereJsonSupersetOf to throw. Redshift lacks a JSON containment operator (Postgres jsonb @> has no equivalent), so a 'where JSON contains X' predicate cannot be compiled. Knex throws at compile time instead of producing an error from the server.
Source
Thrown at lib/dialects/redshift/query/redshift-querycompiler.js:151
jsonInsert(params) {
throw new Error('Json insert is not supported by Redshift');
}
jsonRemove(params) {
throw new Error('Json remove is not supported by Redshift');
}
whereJsonPath(statement) {
return this._whereJsonPath(
'json_extract_path_text',
Object.assign({}, statement, {
path: this.client.toPathForJson(statement.path),
})
);
}
whereJsonSupersetOf(statement) {
throw new Error('Json superset is not supported by Redshift');
}
whereJsonSubsetOf(statement) {
throw new Error('Json subset is not supported by Redshift');
}
onJsonPathEquals(clause) {
return this._onJsonPathEquals('json_extract_path_text', clause);
}
}
module.exports = QueryCompiler_Redshift;
View on GitHub (pinned to e25d54bcb7)
Solutions
- Denormalize the searchable keys into indexed columns or a child table and filter on those.
- Pull candidate rows (filtered by cheaper predicates) and apply the containment test in JavaScript.
- If using Redshift SUPER columns, express containment via PartiQL in a raw where clause.
Example fix
// before
await knex('docs').whereJsonSupersetOf('payload', { tags: 'x' });
// after (filter in JS after a coarse select)
const rows = await knex('docs').select('*');
const matches = rows.filter(r =>
Object.entries({ tags: 'x' }).every(([k,v]) => r.payload?.[k] === v)
); Defensive patterns
Strategy: validation
Validate before calling
function supportsJsonSuperset(client) {
return !/redshift/i.test(client.dialect || client.driverName || '');
}
if (supportsJsonSuperset(knex.client)) {
await knex('docs').whereJsonSupersetOf('payload', { tags: 'x' });
} Type guard
function isRedshiftDialect(client) {
const d = (client && (client.dialect || client.driverName)) || '';
return /redshift/i.test(d);
} Try / catch
try {
await knex('docs').whereJsonSupersetOf('payload', { tags: 'x' });
} catch (err) {
if (/Json superset is not supported by Redshift/i.test(err.message)) {
// denormalize tags into a column, or filter in JS
} else throw err;
} Prevention
- Denormalize searchable JSON keys into indexed columns for Redshift.
- Branch containment queries by dialect.
- Maintain a JSON-capability matrix per dialect.
When it happens
Trigger: Calling any builder method that routes to whereJsonSupersetOf on a Redshift connection: knex('t').whereJsonSupersetOf('payload', {a:1}), or a higher-level helper that emits a superset predicate.
Common situations: Cross-dialect query builders assuming PG jsonb operators; migrating tag/attribute filtering from Postgres to Redshift; analytics pipelines that previously filtered by jsonb containment.
Related errors
- Json subset is not supported by Redshift
- Json set is not supported by Redshift
- Json insert is not supported by Redshift
- Json remove is not supported by Redshift
- Json superset where clause not actually supported by Oracle
AI-assisted analysis of knex/knex@e25d54bcb7 (2026-08-03).
Data as JSON: /data/errors/d2756c6c1e53f69b.json.
Report an issue: GitHub.