The SQLite team announced the first major update of 2022 of their embedded SQL database library. In SQLite 3.38, the JSON module is included by default, eliminating the need for compile-time option. JSON1 module was initially added to SQLite 3.9 in 2015.
The latest version added the -> and ->> operations, which makes it easier to process JSON data. The new operators make it easier for users to work on JSON data that works seamlessly with SQLite, MySQL, and PostgreSQL.
SQLite 3.38 also comes with unixepoch() function for returning a Unix timestamp, sqlite3_error_offset(), virtual table improvements, command-line enhancements, and query planner enhancements. Highlights of the latest release are:
- Added the -> and ->> operators for easier processing of JSON. The new operators are compatible with MySQL and PostgreSQL.
- The JSON functions are now built-ins. It is no longer necessary to use the -DSQLITE_ENABLE_JSON1 compile-time option to enable JSON support. JSON is on by default. Disable the JSON interface using the new -DSQLITE_OMIT_JSON compile-time option.
- Enhancements to date and time functions:
- Added the unixepoch() function.
- Added the auto modifier and the julianday modifier.
- Rename the printf() SQL function to format() for better compatibility. The original printf() name is retained as an alias for backwards compatibility.
- Added the sqlite3_error_offset() interface, which can sometimes help to localize an SQL error to a specific character in the input SQL text, so that applications can provide better error messages.
- Enhanced the interface to virtual tables as follows:
- Added the sqlite3_vtab_distinct() interface.
- Added the sqlite3_vtab_rhs_value() interface.
- Added new operator types SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET.
- Added the sqlite3_vtab_in() interface (and related) to enable a virtual table to process IN operator constraints all at once, rather than processing each value of the right-hand side of the IN operator separately.
- CLI enhancements:
- Columnar output modes are enhanced to correctly handle tabs and newlines embedded in text.
- Added options like “–wrap N”, “–wordwrap on”, and “–quote” to the columnar output modes.
- Added the .mode qbox alias.
- The .import command automatically disambiguates column names.
- Use the new sqlite3_error_offset() interface to provide better error messages.
- Query planner enhancements:
- Use a Bloom filter to speed up large analytic queries.
- Use a balanced merge tree to evaluate UNION or UNION ALL compound SELECT statements that have an ORDER BY clause.
- The ALTER TABLE statement is changed to silently ignores entries in the sqlite_schema table that do not parse when PRAGMA writable_schema=ON.