Skip to content
Back to skills

Sqlite Knowledge Patch

ASecurity

SQLite

  • 25 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 27, 2026
developmentgoshellsqlexpressgitapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill sqlite-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sqlite Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sqlite Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-sqlite-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-sqlite-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sqlite-knowledge-patch
description: SQLite
version: "3.54.1"
license: MIT
metadata:
  author: Nevaberry
---


# SQLite Knowledge Patch

Load this skill when changing SQLite SQL, schema migrations, C integrations,
CLI scripts, builds, extensions, or database storage behavior. Use the topic
references for complete conditions, examples, compatibility details, and fixes.

## Reference index

| Reference | Topics |
| --- | --- |
| [C APIs and Configuration](references/c-api-and-configuration.md) | Preparation, limits, connection controls, callbacks, text results, diagnostics, page cache, legacy C APIs |
| [CLI, Builds, and Utilities](references/cli-build-and-utilities.md) | CLI compatibility, output, scripts, platform requirements, source builds, replication, Tcl |
| [Core Scalar Functions](references/core-scalar-functions.md) | Conditionals, collation, formatting, Unicode, binary conversion, concatenation, dates |
| [FTS5, Sessions, and Extensions](references/fts5-sessions-and-extensions.md) | Tokenizers, FTS integrity, changegroups, virtual tables, carray, percentiles, series, database pages |
| [JSON and JSONB](references/json-and-jsonb.md) | Validation, legacy BLOBs, JSON5, labels, edits, formatting, traversal |
| [SQL Language and Schema](references/sql-language-and-schema.md) | Constraints, triggers, indexes, statistics, query semantics, transactions, correctness fixes |
| [Storage, Locking, and Correctness](references/storage-locking-and-correctness.md) | Lock timeouts, WAL, copying, OPFS, VFS, serialization, file compatibility |

## Compatibility changes and deprecations

### CLI scripts and output

- End SQL statements with `;` in scripts that previously used a line containing
  only `go` or `/`. Build with `-DSQLITE_SHELL_LEGACY_COMMAND_TERMINATOR` to retain
  those terminators.
- `.indexes PATTERN` matches index names. Scripts that passed a table-name
  pattern may need to change it.
- Interactive sessions default to Unicode boxes; batch sessions retain the
  legacy default. Tabular modes right-align numeric values by default.
- Columnar modes default to `--titles always`, including empty results.
  Use `-titles on` for headers only with nonempty results, or `--rowcount on`
  to display the number of rows.
- The CLI escapes most control characters by default. `.dump` uses `unistr()`
  to encode special characters; restoring those expressions requires SQLite
  3.50.0 or later. Set `--escape off` when producing a dump for an older version.
- The optional `diskused()` extension reports database space use. The CLI's
  `.diskused` exposes it, replacing the deprecated `sqlite3_analyzer` utility.
- The CLI disables double-quoted string literals by default from 3.41.0.
  Use single quotes, or enable `.dbconfig dqs_dml on` and `.dbconfig dqs_ddl on`
  for legacy SQL. From 3.45.0, replay of `.dump` output adjusts compatibility
  settings automatically.

### Schema and numeric behavior

- SQLite 3.54.0 rejects adding, dropping, or renaming columns with special names
  `ROWID`, `_ROWID_`, or `OID`.
- `STRICT` tables enforce declared types of generated columns. A write can
  fail when a generated expression produces an incompatible value.
- Floating-point to text conversion rounds to 17 significant digits by default.
  Use `SQLITE_DBCONFIG_FP_DIGITS` with `sqlite3_db_config()` to select a different
  precision, such as the previous 15 digits.
- SQLite 3.48.0 changes how `EXPLAIN QUERY PLAN` reports covering indexes;
  tests comparing plan text verbatim can see differences after upgrading.
- From 3.36.0, referencing the implicit `rowid` of a view or subquery raises an
  error. Select the underlying table's rowid into a named result column, or
  build with `-DSQLITE_ALLOW_ROWID_IN_VIEW` for legacy behavior.
- From 3.37.0, `generate_series()` requires `START`. Pass it explicitly in
  zero-argument calls, or build with `-DZERO_ARGUMENT_GENERATE_SERIES` to
  preserve the legacy default.

### Builds and database compatibility

- SQLite withdrew 3.52.0 because some new features caused backward-compatibility
  issues. All features planned for it moved to 3.53.0.
- Windows builds require Windows Vista or later, dropping Windows XP and
  Windows CE support. Compile with `-DSQLITE_UWP=1` for UWP and WebUI applications.
  SQLite 3.53.0 drops Windows RT support.
- For Windows command-line tools, `SQLITE_USE_W32_FOR_CONSOLE_IO` selects Win32
  console I/O and replaces the removed `SQLITE_USE_STDIO_FOR_CONSOLE` option.
- Canonical-source `configure` uses Autosetup. Most targets need a C compiler
  and `make` or `nmake`; tests and Tcl-dependent tools still require Tcl.
  The amalgamation tarball's main `./configure` also uses Autosetup; deprecated
  `tea/` uses Autotools.
- SQLite 3.50.0 can open older OPFS SAHPool databases. Databases created by the
  3.50.0 or later SAHPool VFS require a VFS at least as new as 3.50.0.
- From 3.31.0, `PRAGMA legacy_file_format` is a no-op. Use
  `SQLITE_DBCONFIG_LEGACY_FILE_FORMAT` with `sqlite3_db_config()` for legacy readers.
- `sqlite3_pcache_methods`, `SQLITE_CONFIG_PCACHE`, and `SQLITE_CONFIG_GETPCACHE`
  are deprecated. Use `sqlite3_pcache_methods2` with `SQLITE_CONFIG_PCACHE2`
  to install a page cache and `SQLITE_CONFIG_GETPCACHE2` to retrieve its configuration.

## Schema changes and query behavior

`ALTER TABLE` can add and remove `NOT NULL` and `CHECK` constraints on existing
tables. Run `REINDEX EXPRESSIONS;` to rebuild expression indexes; SQLite 3.53.0
also adds self-healing for stale expression indexes.

```sql
CREATE TABLE readings (value REAL);
ALTER TABLE readings ALTER COLUMN value SET NOT NULL;
ALTER TABLE readings ALTER COLUMN value DROP NOT NULL;
```

`PRAGMA optimize` automatically analyzes tables lacking `sqlite_stat1` entries.
The planner can build automatic indexes for `WITHOUT ROWID` tables. For plans
with equal estimated cost, it chooses the one with fewer bytes per row.

`generate_series()` can use predicates on `value` to bound generated rows,
including an upper bound when the call omits `stop`.

```sql
SELECT value FROM generate_series(1) WHERE value BETWEEN 10 AND 12;
```

## Scalar functions and formatting

Two-argument `iif(test, value)` and the `if()` alias are available from 3.48.0.
From 3.49.0, both accept multiple test/value pairs and an optional fallback.
Evaluation short-circuits; the result is `NULL` if no test succeeds and no fallback
is supplied.

```sql
SELECT iif(0, 'yes');                           -- NULL
SELECT if(0, 'first', 1, 'second', 'fallback'); -- second
```

Use `unistr_quote()` to serialize a value into generated SQL. For text with control
characters such as U+0001, it emits a `unistr()` expression. `%#q` and `%#Q` in `format()` or
`sqlite3_mprintf()` escape control characters in a form `unistr()` can decode.
SQLite's built-in printf and SQL `format()` support `%J` and `%j` for JSON string
escaping. `unistr()` decodes Unicode escapes; the scalar reference lists the forms.

SQLite 3.50.2 retains empty strings in `concat_ws()` output, including surrounding
separators. A sole empty-string input to aggregate `group_concat()` returns an
empty string; from 3.46.1, so does a window frame containing a single empty string.

Use `weekday -N` to shift backward to weekday `N`, and `end of month` to select
the month's last day. `utc` and `localtime` leave values unchanged when SQLite
already knows they are in the requested time zone.

## JSON validation, editing, and traversal

- `jsonb(X)` can return a BLOB after checking only its outermost element.
  Use `json_valid(X, 8)` for full JSONB validation; flag `4` checks only the wrapper.
- `json_valid(X, flags)` errors for flags outside `1` through `15`, and returns
  SQL `NULL` if either argument is SQL `NULL`.
- SQLite 3.45.1 restored interpreting JSON-looking BLOBs as text when they cannot
  be interpreted as JSONB. Convert values known to hold legacy JSON text to `TEXT`;
  a BLOB can have different values under the two interpretations.
- `json_group_object()` skips rows whose label is SQL `NULL`.
- `json_array_insert()` inserts at an array index and shifts subsequent elements;
  `jsonb_array_insert()` returns JSONB.
- `jsonb_each()` walks immediate children; `jsonb_tree()` walks recursively.
  Their `value` column returns JSONB blobs for arrays and objects, and the usual
  SQL values for scalars.

## C integrations and connection controls

`SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE`, `SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE`,
and `SQLITE_DBCONFIG_ENABLE_COMMENTS` default to enabled. These calls respectively
prevent file creation by `ATTACH`, make attachments read-only, and disable comments:

```c
sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE, 0, (int *)0);
sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE, 0, (int *)0);
sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_COMMENTS, 0, (int *)0);
```

SQLite accepts comments when loading existing `sqlite_schema` even with the
comments setting off; it still controls comments in newly submitted SQL.

Pass `SQLITE_PREPARE_DONT_LOG` to `sqlite3_prepare_v3()` to keep malformed SQL
out of the error log; the return code still reports preparation success.
Virtual tables can use `SQLITE_PREPARE_FROM_DDL` for SQL derived from the schema.
Long-running preparation can invoke progress handlers and respond to
`sqlite3_interrupt()`; account for callbacks during preparation.

Use `SQLITE_LIMIT_PARSER_DEPTH`, `SQLITE_LIMIT_SCHEMA`, and
`SQLITE_LIMIT_TRIGGER_STEPS` with `sqlite3_limit()` to control parser depth,
schema size, and trigger steps per connection. The minimum `SQLITE_LIMIT_LENGTH`
is 30 bytes, and the default maximum number of SQL function arguments is 1000.

From 3.45.0, register functions calling `sqlite3_result_subtype()` with
`SQLITE_RESULT_SUBTYPE`; without it, setting a subtype can silently do nothing.
`-DSQLITE_STRICT_SUBTYPE=1` turns an undeclared call into an SQL error.

## FTS, sessions, and optional extensions

Use `fts5_tokenizer_v2` and table option `locale=1` for locale-aware FTS5 tokenizers.
`contentless_unindexed=1` persists `UNINDEXED` values in a contentless FTS5 table.
For `xInstToken()` with prefix queries, enable token collection with table setting
`insttoken` or wrap one search expression in `fts5_insttoken()`.

The session extension tracks tables with generated columns and `WITHOUT ROWID`
tables. `sqlite3changeset_apply_v3()` applies changesets. Use
`sqlite3changegroup_change_begin()`, the `sqlite3changegroup_change_*` value
setters, and `sqlite3changegroup_change_finish()` to add an individual change.

The amalgamation includes carray and percentile but disables them by default.
Compile `sqlite3.c` with `-DSQLITE_ENABLE_CARRAY` or `-DSQLITE_ENABLE_PERCENTILE`
to enable the corresponding extension. The CLI includes `median()`,
`percentile()`, `percentile_cont()`, and `percentile_disc()`.

## Storage, locks, and operational tools

On builds supporting blocking locks, `sqlite3_setlk_timeout()` sets their timeout
independently of `sqlite3_busy_timeout()`. In 3.50.1, it also applies when opening
a snapshot transaction or waiting for another process to finish recovery.

`PRAGMA wal_checkpoint=NOOP;` reports WAL frame count and frames already
checkpointed; C callers use `SQLITE_CHECKPOINT_NOOP` with
`sqlite3_wal_checkpoint_v2()`. Monitor temporary buffers spilling to disk with
`SQLITE_DBSTATUS_TEMPBUF_SPILL`; `sqlite3_db_status64()` returns 64-bit counters,
and the option also works with `sqlite3_db_status()`.

With URI filenames enabled, `reserve=N` in the `VACUUM INTO` destination sets
reserved bytes per page in the copy, from 0 through 255. From 3.40.0,
`VACUUM INTO` honors `PRAGMA synchronous`.

The `opfs-wl` VFS uses Web Locks for OPFS locking; select `vfs=opfs-wl` on browsers
providing `Atomics.waitAsync()`. `sqlite3_rsync` supports rollback-journal mode
and accepts `-p PORT` or `--port PORT` for the SSH port.

Use CLI `--ifexists` at startup or with `.open` to fail on a missing database.
A nonempty `.sql` or `.txt` command-line argument executes as a script containing
SQL and dot-commands. `.timer once` times the next SQL statement only;
`.progress --timeout S` interrupts SQL statements after `S` seconds.

Files in this skill

  • SKILL.md4 KB
  • references/fts5-internals.md1.1 KB
  • references/json.md1.3 KB
  • references/new-apis.md2.3 KB
  • references/sql-functions.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.