Oddbean new post about | logout

Notes by 3422387b | export

 nostr:npub13sydufhd6063udz3ghqjhmvff4alx40gcy6dn0aw6w9vqw6kepfsam4wqt Sure. Send me the SQL state... 
 @f6217321 Here is a gist that tests the presence of JSON functions: https://gist.github.com/groue/046ebddb4a410304094c022d756081c8 Unexpected results are reported as XCTest failures. I hope it will be handy for you! 
 nostr:npub13sydufhd6063udz3ghqjhmvff4alx40gcy6dn0aw6w9vqw6kepfsam4wqt Just check on macOS Catalin... 
 @f6217321 Oh, now this is a pretty old version of the JSON1 extension. Maybe not all JSON features are available 🤔 if you have some time, I'd be glad to help you gathering the availability of individual JSON SQL functions on various macOS versions! 
 nostr:npub13sydufhd6063udz3ghqjhmvff4alx40gcy6dn0aw6w9vqw6kepfsam4wqt In macOS Monterey 12.6.2 I'... 
 @f6217321 Oh, this one means that macOS 12.6 was shipping with JSON functions even before SQLite 3.38. That possibility was documented, but thanks for the conformation Martin ❤️ I'll be able to update the availability checks! 
 nostr:npub13sydufhd6063udz3ghqjhmvff4alx40gcy6dn0aw6w9vqw6kepfsam4wqt Oh that looks interesting. ... 
 @f6217321 Yes, please! JSON support is built-in starting SQLite 3.38.0. As far as I know, this means iOS 16+, macOS 13.2+, tvOS 17+, and watchOS 9+. Those availabilities are a reasonable guess: I don't have any device to make sure they hold. Maybe you can check some of them? If you have a target device at hand,  you can run `select sqlite_version(), json('true’)`: it tells the SQLite version and fails at runtime if the JSON extensions are not built-in. 
 I'm polishing a #GRDB pull request that lets you deal with JSON values at the SQLite level (access to subcomponents by key or JSON path, indexes on json expressions, support for strict and flexible JSON schemas, and more). If you're interested, please chime in: the PR comes with a rather complete description, and new APIs are already fully documented https://github.com/groue/GRDB.swift/pull/1436