Skip to content

feat: add native SQLite function mode and deprecate legacy overrides - #647

Merged
lovasoa merged 3 commits into
masterfrom
native-math-legacy-option
Nov 10, 2026
Merged

lovasoa merged 3 commits into
masterfrom
native-math-legacy-option

Conversation

@lovasoa

@lovasoa lovasoa commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

SQLite's native math functions are now available in sql.js, while existing legacy functions remain enabled by default. Calling a legacy function prints a deprecation warning; functions called for many rows can produce many warnings. A future major release will disable these functions by default.

To try the future behavior now:

const SQL = await initSqlJs({ useOldExtensionFunctions: false });

Before opting in:

  • log(x) changes from the natural logarithm to base 10 logarithm (log(100)=2 now); use ln() for the natural logarithm.
  • Some invalid inputs now return NULL instead of 0, and native sign() returns an integer. Native sign() also works in expression indexes and generated columns.
  • Legacy-only functions such as reverse, charindex, median, and stdev are unavailable, including in saved views and triggers. You can use sql.js to register your own implementation of the functions.

The first initialization chooses the mode for the module. In a worker, pass config: { useOldExtensionFunctions: false } on the first message. Both modes gain native functions including ln, log2, mod, trunc, pow, ceiling, and two-argument log.

Related

@lovasoa
lovasoa merged commit d312b67 into master Nov 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant