npm / knex
knex
What changed in knex 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
1 security6 new APIs and options13 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initknex 320 changes
Security 1
PostgreSQL searchPath values escape double quotes to prevent SQL injection.
New APIs and options 6
Adds a connectionPool option for using an external pool.
Adds knex.migrate.before for migration operations.
Adds knex.migrate.to for migration operations.
Adds MariaDB driver support.
Adds support for returning in MariaDB.
Adds support for token-credential in MSSQL authentication.
Fixes and other changes 13
Preserves binding order in PostgreSQL and MSSQL delete and update queries.
Fixes SQLite conditional insert/merge when inserting multiple rows.
Sets error.cause for Tarn acquire connection errors.
Fixes FOR UPDATE OF when used with an explicit schema.
Fixes _setNullableState so it respects the schema.
Makes stream postProcessResponse errors catchable with .on('error').
Fixes an unhandled error on connection timeout with stream.
Preserves PostgreSQL updateFrom binding order.
Fixes the .where type regression for invalid types.
Aliases in analytic functions are now properly escaped.
Type definitions now support Array<Buffer>, which was already supported in code.
DELETE queries support LIMIT in dialects that support it, such as MySQL, while remaining disallowed in dialects that do not.
SQLite appends a RETURNING statement when inserting an empty row.