fix(sql): quote all IN-list values uniformly in expaste

Previously, pure numeric values (e.g. 90001543) in the IN clause were not quoted while values with leading zeros (e.g. 00040787) were, causing inconsistent quoting. Now all non-NULL values are uniformly quoted.
This commit is contained in:
gggaiitx authored and GitHub committed 2026-07-08 10:36:01 +08:00
1 parent bb959697d0
commit 6041c3f70b
2 files changed
+3 -5

No files matched your search

@@ -21,7 +21,7 @@ describe("sqlInListPaste", () => {
it("splits simple slash-separated value lists", () => {
expect(buildSqlInConditionFromPasteSource("1/2/3")).toEqual({
ok: true,
sql: "IN (1, 2, 3)",
sql: "IN ('1', '2', '3')",
valueCount: 3,
});
expect(buildSqlInConditionFromPasteSource("A/B/C")).toEqual({
@@ -37,10 +37,10 @@ describe("sqlInListPaste", () => {
expect(buildSqlInConditionFromPasteSource("/Users/staff/dbx")).toEqual({ ok: false, reason: "not-list" });
});
it("preserves numeric and NULL literals while quoting strings", () => {
it("quotes all non-NULL values uniformly including numbers", () => {
expect(buildSqlInConditionFromPasteSource("1\n-2.5\n001\nnull\nA1")).toEqual({
ok: true,
sql: "IN (1, -2.5, '001', NULL, 'A1')",
sql: "IN ('1', '-2.5', '001', NULL, 'A1')",
valueCount: 5,
});
});