Skip to content

node:sqlite: "VACUUM INTO" gives error "no such function: floor" #56435

Description

@topvis

Version

22.11.0

Platform

Microsoft Windows NT 10.0.22631.0 x64

Subsystem

node:sqlite

What steps will reproduce the bug?

import { DatabaseSync } from 'node:sqlite';
const db = new DatabaseSync(dbName);
db.exec(`VACUUM INTO '${backupName}';`);

How often does it reproduce? Is there a required condition?

name point calcPoint
Alex 11.5 11

I tested the code with a very simple database with only one table as shown in the table. The column calcPoint is a generated column defined by floor(point). It generates error Error: no such function: floor.
If I remove the generated column calcPoint, VACUUM INTO works without error.

What is the expected behavior? Why is that the expected behavior?

VACUUM INTO should work when function floor is used.

What do you see instead?

VACUUM INTO gives error "Error: no such function: floor" when function floor is used.

Additional information

This issue might exists for other sqlite functions as well.

Activity

  1. cjihrig commented on Jan 2, 2025

    @cjihrig
    Contributor

    It seems like the issue is related to the use of floor() and not VACUUM itself. Is that correct?

    I'm guessing this is because SQLite is currently compiled without SQLITE_ENABLE_MATH_FUNCTIONS.

  2. topvis commented on Jan 2, 2025

    @topvis
    Author

    That is likely the reason.

  3. JeffreyHyer commented on Jan 2, 2025

    @JeffreyHyer

    I'm running into this issue as well, not with VACCUM specifically, but with the missing math functions: FLOOR, CEIL, etc (https://www.sqlite.org/lang_mathfunc.html).

    I just wanted to add a +1 to getting those enabled by default unless there's a good reason not to?

    Node v23.5.0

    import { DatabaseSync } from 'node:sqlite'
    
    const db = new DatabaseSync(':memory:')
    
    db.exec('SELECT FLOOR(1.275)')
    
  4. added a commit that references this issue on Jan 3, 2025
  5. added a commit that references this issue on Jan 5, 2025
  6. added a commit that references this issue on Jan 13, 2025
  7. added a commit that references this issue on Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions