News for hackers. Stuff that matters.
Re:New JSON query operators in SQLite 3.38.0 by jrochkind1 on Sunday February 27, 2022 @10:34AM (#30489352)
These look like they match what postgres uses? Not sure if postgres invented it, or got it from somewhere else? Time for some specs/standards for JSON operators in SQL?
Re:New JSON query operators in SQLite 3.38.0 by simonw on Sunday February 27, 2022 @10:51AM (#30489488)
Yeah, the SQLite team cited PostgreSQL as the inspiration here.

I asked them if they'd considered the most recent syntax added by PostgreSQL - "where jsoncol["prop"] = 'x'" - but sadly that was incompatible with other existing SQLite syntax.

Re:New JSON query operators in SQLite 3.38.0 by xtreak29 on Sunday February 27, 2022 @11:58AM (#30490144)
Re:New JSON query operators in SQLite 3.38.0 by jrochkind1 on Sunday February 27, 2022 @12:35PM (#30490518)
One comment there points out some differences with the operators in pg, which I don't entirely follow honestly.

https://sqlite.org/forum/forumpost/a0d681bb2432eebc

Re:New JSON query operators in SQLite 3.38.0 by bokwoon on Sunday February 27, 2022 @12:58PM (#30490706)
hi I was the one who made that comment. The JSON incompatibilities I was referring to at that time was for an older version of the JSON proposal. The current version of the JSON operator in SQLite mimics Postgres (and MySQL) perfectly and I'm very happy about that.

In the older version of the proposal, -> was identical to ->> except -> returned NULL on malformed JSON (while ->> raised an error). Both -> and ->> would automatically convert a JSON-encoded SQL string '"like this"' into an SQL string 'like this'. This is not how the -> operator behaves in Postgres and MySQL, and my examples were simply trying to point out that incompatibility.

Re:New JSON query operators in SQLite 3.38.0 by jrochkind1 on Monday February 28, 2022 @05:30PM (#30506067)
I also didn't realize MySQL supported these JSON query operators now, huh. Since MySQL 2.7.9 in 2015 apparently? Not that new!

https://dev.mysql.com/doc/refman/5.7/en/json-search-function...

Re:New JSON query operators in SQLite 3.38.0 by jrochkind1 on Sunday February 27, 2022 @06:10PM (#30493804)
Nice, thanks!
Re:New JSON query operators in SQLite 3.38.0 by jrochkind1 on Sunday February 27, 2022 @12:33PM (#30490489)
I didn't even KNOW about that new syntax in postgres! I'll be using it now that you've pointed it out, thanks.