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
SQLite JSONB not coerced if type is capitalized. #4337
#3968 introduced coercing a column to json if its type is jsonb. However, if the type is given as JSONB the coercion is not applied.
With capitalized JSONB type
constlistSensors=`-- name: ListSensors :manySELECT id, name, description, properties, created_at, updated_at, deleted_at, thing_id, feature_id FROM sensors WHERE deleted_at is NULL AND (CAST(?1 AS BOOLEAN) IS FALSE OR thing_id IN (/*SLICE:thing_ids*/?)) ORDER BY created_at`
With uncapitalized jsonb type
constlistSensors=`-- name: ListSensors :manySELECT id, name, description, json(properties), created_at, updated_at, deleted_at, thing_id, feature_id FROM sensors WHERE deleted_at is NULL AND (CAST(?1 AS BOOLEAN) IS FALSE OR thing_id IN (/*SLICE:thing_ids*/?)) ORDER BY created_at`
Relevant log output
Database schema
CREATETABLEthings (
id INTEGERPRIMARY KEYNOT NULL,
properties JSONB NOT NULL DEFAULT (JSONB('{}'))
);
CREATETABLEthings_2 (
id INTEGERPRIMARY KEYNOT NULL,
properties jsonb NOT NULL DEFAULT (jsonb('{}'))
);
Activity
TimVosch commentedon Mar 11, 2026
I am currently testing to simply add a strings.ToLower(..) here:
https://github.com/sqlc-dev/sqlc/pull/3968/changes#diff-e4e02703e83f32810a38562ae9f64e566ad4906f2cd6af0f48b46ae8a89bbf92R42
fix(sqlc-dev#4337): SQLite JSONB not coerced if type is capitalized
TimVosch commentedon Mar 11, 2026
I've opened a PR #4338
fix(sqlite): make JSONB coercion case-insensitive in selector
Coerce SQLite JSONB output regardless of type casing