News for hackers. Stuff that matters.
Re:JSONB Has Landed in SQLite by nikeee on Wednesday December 06, 2023 @03:58AM (#38541783)
If my application never sees a difference top JSON, everything is compatible and all there is are perf improvements, why ist there a new set of functions top interact with it (jsonb_*)?

It seems that the JSON type is even able to contain JSONB.

Re:JSONB Has Landed in SQLite by dtech on Wednesday December 06, 2023 @04:14AM (#38541868)
The difference is the storage format, which is important for a SQL database since you define it in the schema. Also the performance characteristics are different.
Re:JSONB Has Landed in SQLite by The_Colonel on Wednesday December 06, 2023 @04:35AM (#38541995)
As someone mentioned below, the order of keys is undefined in JSON spec, but applications may rely on it anyway, and thus conversion to JSONB may lead to breakage.

There are some other minor advantages of having exact representation of the original - e.g. hashing, signatures, equality comparison is much simpler on the JSON string (you need a strict key order, which is again undefined by the spec, but happens in the real world anyway).

Re:JSONB Has Landed in SQLite by 0x457 on Wednesday December 06, 2023 @01:49PM (#38547964)
`json_` functions return json, `jsonb_` functions return jsonb. Both take either as input.

If you're modifying something "in-place" then `jsonb_` functions would be better since they avoid conversion.