SQLite Forum

Proposed JSON enhancements.
Login
> errors due to malformed json can't happen

Here is a counter example that I just ran on PG 9.6 over at [sqlfiddle](https://sqlfiddle.com):

> ~~~
SELECT '{not valid json}'::json -> 'a';
~~~

I am aware that -> and ->> are different in PG.  If you stick
to using ->>, then the SQL should be portable, I think.  I understand
that in PG (and in MySQL too) the -> operator returns JSON and the
->> operator returns TEXT.  It's the same in SQLite, really.  It is just
that in SQLite, JSON is indistinguishable from TEXT and so both
operators end up working the same.

I did make SQLite's ->> operator use json_extract(), not json_nextract(),
so that it had error semantics that are more similar to PG - specifically
it has zero tolerance for ill-formed JSON.

Regarding the difference between -> and ->> in PG, I see how ->> can be
useful, but I'm having a hard time coming up with examples for when -> would
be useful.  Can you enlighten me?