Skip to content

Compare quoted numerals by SQLite storage class - #25

Draft
gblikas wants to merge 18 commits into
mainfrom
cursor/quoted-compare-9f53
Draft

gblikas wants to merge 18 commits into
mainfrom
cursor/quoted-compare-9f53

Conversation

@gblikas

@gblikas gblikas commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

SQL and in-memory disagreed on numeric values, an empty field name was dropped in the search box, a bad limit was accepted by one engine, and a wildcard stopped at a null byte. Those are fixed.

  • A quoted decimal such as count:>"2" was text in SQL and a number in memory.
  • A bare numeral such as year:2024 or year in (2024) matched digit text in inline SQL and missed it elsewhere. A bare decimal such as year:2024.0 did the reverse.
  • Virtual-field membership (team:assigned) dropped a numeric id that memory kept.
  • A denied value could slip through a wildcard (secret:hid*).
  • "":todo lost the empty name, so a schema of only status treated it as that field.
  • An empty sort direction sorted on inline SQL and threw on Drizzle and in-memory.
  • A NaN or -Infinity limit was ignored by Drizzle and rejected by the other engines. A boolean limit returned rows from inline SQL and threw elsewhere. true is 1 and false is 0.
  • A string limit such as "2", "2.0", "02", or "2e1" was an integer in SQL and threw elsewhere. Those spellings are that integer. "2.5" still throws.
  • title:*b missed a stored null byte in SQL and matched it in memory. A wildcard now crosses U+0000, including when the pattern itself contains one.

A number now matches integer or real storage, and text stays text. NULL stays unknown. A sort direction must be asc or desc. A limit or offset must be finite; digit strings that SQLite reads as integers are those integers.

Local suite: 187 suites, 3834 tests. CI is running on 4f1003c.

Open in Web Open in Cursor 

A quoted decimal is the number it spells against a numeric value and stays
text against a string, for equality and for !=, >, >=, < and <=. Inline
SQL, parameterized SQL and Drizzle on a SQLite column now match the
in-memory adapter, including on a column with no affinity. NULL stays
unknown.
@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
querykit Ready Ready Preview Oct 20, 2026 5:06pm UTC

Request Review

createQueryKit already rejects an exact denyValues match. A LIKE
pattern that would match that value, including under NOT or OR, is
now rejected the same way before either adapter runs. SQL translators
are unchanged.
team:assigned resolves to an IN list. A member "7" now matches a stored
7 and the text 7 on inline SQL, parameterized SQL, and Drizzle, as it
already did in memory and as equality already did.
A TEXT column turned an integer literal into text, so year:2024 matched the string 2024. Inline equality now matches only integer and real storage, which is what parameterized SQL and in-memory already returned.
A TEXT column compared year:>2024 as text, so inline SQL, a bound real, and in-memory class order returned different ids. Ordered comparisons of a number now follow storage class on SQLite: text is greater than every number, and integer and real storage stay numeric.
Inline SQL applied text affinity to year in (2023, 2024) and year not in (2024), so a TEXT column of those digits disagreed with parameterized SQL, Drizzle, and in-memory. A bare number in an inline list now uses the same storage-class comparison as equality. Integer columns still match the numbers in the list.
A bound JavaScript number is a real, and a TEXT column reads that real as the text 2024.0. Parameterized SQL and Drizzle now keep equality and membership of a bare number on integer and real storage, matching inline SQL and in-memory filtering. A REAL column still matches 2024.
"":todo names a column whose name is empty. The search box dropped that
name, so a schema of only status treated the query as valid, and an empty
prefix would suggest status. The name stays listed, and an empty prefix
matches no field.
An empty orderBy direction was written as ORDER BY with no keyword, so
SQLite sorted ascending while Drizzle and in-memory rejected it.
Drizzle omitted a NaN limit because NaN >= 0 is false and a NaN offset
because NaN is falsy, so status:a returned rows. SQLite and in-memory
already rejected that window.
Drizzle treated -Infinity as a negative limit, so a bare -Infinity limit
was omitted and status:a returned rows. Beside an offset it was written
as LIMIT -1. Infinity and -Infinity are not integers; reject them with NaN
before the statement is built.
SQLite reads TRUE as 1 and FALSE as 0, so LIMIT true on status:a returned
a row while Drizzle, in-memory, and the kits rejected the boolean.
Number.isFinite and Number.isInteger are both false for a boolean, and
better-sqlite3 cannot bind one. Read true as 1 and false as 0 before
those checks, and inline TRUE or FALSE in parameterized SQL.
SQLite reads LIMIT '02' and LIMIT '+2' as 2 and rejects LIMIT '2.5'.
QueryKit now reads the first two as 2 before the integer checks, and
still leaves a non-zero fraction unchanged.
SQLite reads LIMIT '-2' as no upper bound and LIMIT '2e1' as 20, and
rejects LIMIT '+ 2'. QueryKit now reads the first two as -2 and 20
before the integer checks. The kit forwards maxLimit for the negative
spelling so the cap stays on. A spaced sign stays a string.

This branch was successfully deployed

1 active deployment
Preview — 4f1003c8 Deployed Oct 20, 2026 by vercel[bot]
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.

2 participants