Earlier quoted context omitted.
That's what I said I think? "JSON" is a TEXT that is handled as a JSON string by `json_*` functions, while "JSONB" is a BLOB that is handled as an internal format by `jsonb_*` functions. You generally don't want JSONB in the application side though, so you do need a conversion for that.
Yes, but when you use the BLOB with jsonb functions, your application demands go from: Read JSON from TEXT column. Parse JSON into Internal Binary Format. Run json_*() function on this format, which will Serialize Internal Binary Format to JSON as output. To: Read JSONB from BLOB column. Run json_*() function on Internal Binary Format, which will serialize the Internal Binary Format to JSON as output. Because: The js…
I don’t think that’s always correct (it is within this thread, which stated (way up) “if you’re always reading/writing the full blob”, but I think this discussion is more general by now). Firstly, it need not convert the full jsonb blob (example: jsonb_extract(field,'$.a.b.c.d.e'))
Secondly, it need not convert to text at all, for example when calling a jsonb_* function that returns jsonb.
(Technically, whether any implementation is that smart is an implementation detail, but the article claims this is
“a rewrite of the SQLite JSON functions that, depending on usage patterns, could be several times faster than the original JSON functions”
so it can’t be completely dumb.