Skip to content

Commit 9239d46

Browse files
committed
fix(#4337): SQLite JSONB not coerced if type is capitalized
1 parent ce83d3f commit 9239d46

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/compiler/selector.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package compiler
22

3+
import (
4+
"strings"
5+
)
6+
37
// selector is an interface used by a compiler for generating expressions for
48
// output columns in a `SELECT ...` or `RETURNING ...` statement.
59
//
@@ -39,7 +43,7 @@ func (s *sqliteSelector) ColumnExpr(name string, column *Column) string {
3943
// outside of the database itself. For jsonb columns in SQLite, wrap values
4044
// in `json(col)` to coerce the internal binary format to JSON parsable by
4145
// the user-space application.
42-
if column.DataType == "jsonb" {
46+
if strings.ToLower(column.DataType) == "jsonb" {
4347
return "json(" + name + ")"
4448
}
4549
return name

0 commit comments

Comments
 (0)