sql-js / sql-js/sql.js

Returning zero from user-defined function treated as returning null

Open
#296 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

db = new Database();
db.create_function(
    "returnZero",
    () => 0
);
db.exec("SELECT returnZero(), 0");

Expected:

returnZero() 0
0 0

Actual:

returnZero() 0
null 0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the JavaScript create_function entry point and follow how its callback result reaches the exec query result. Reproduce the supplied returnZero example and compare it with the literal 0 result. Done means the user-defined function returns 0 rather than null.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sqlite, wasm
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.