Skip to content

sqlite: enable the "decimal" extension #63119

@Ecco

Description

@Ecco

What is the problem this feature will solve?

In current builds of node, it is not possible to perform decimal math with Sqlite, even though it is possible with the Sqlite CLI.

Example with Node

import { DatabaseSync } from "node:sqlite"
const db = new DatabaseSync(":memory:")
const sql = db.createTagStore()
console.log(sql.run`SELECT decimal('1.2')`)

returns

console.log(sql.run`SELECT decimal('1.2')`)
                   ^
Error: no such function: decimal
    at ModuleJob.run (node:internal/modules/esm/module_job:437:25)
    at async node:internal/modules/esm/loader:639:26
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
  code: 'ERR_SQLITE_ERROR',
  errcode: 1,
  errstr: 'SQL logic error'
}

Example with the CLI

sqlite> SELECT decimal('1.2');
┌────────────────┐
│ decimal('1.2') │
├────────────────┤
│ 1.2            │
└────────────────┘

What is the feature you are proposing to solve the problem?

I think node should build sqlite with the decimal extension enabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.sqliteIssues and PRs related to the SQLite subsystem.

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions