Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
topvis opened this issue Jan 2, 2025 · 3 comments · Fixed by #56447
Closed

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

topvis opened this issue Jan 2, 2025 · 3 comments · Fixed by #56447

Comments

@topvis
Copy link

topvis commented Jan 2, 2025

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.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 2, 2025

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.

@topvis
Copy link
Author

topvis commented Jan 2, 2025

That is likely the reason.

@JeffreyHyer
Copy link

JeffreyHyer commented Jan 2, 2025

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)')

cjihrig added a commit to cjihrig/node that referenced this issue Jan 3, 2025
This commit enables SQLite math functions.

Fixes: nodejs#56435
targos pushed a commit that referenced this issue Jan 13, 2025
This commit enables SQLite math functions.

Fixes: #56435
PR-URL: #56447
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this issue Jan 13, 2025
This commit enables SQLite math functions.

Fixes: nodejs#56435
PR-URL: nodejs#56447
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
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 a pull request may close this issue.

3 participants