COALESCE isn`t work
Author: IMMSPgisgroupCreated Oct 6, 2021Updated Sep 10, 2026
LabelsHelp wantedBug: Code provided to reproducedGood first issue
In AlaSQL 1.7.3 I see strange bug with COALESCE. In AlaSQL 0.4.11 I saw this bug too. Sample is very simple.
JSON.stringify(alasql(`SELECT COALESCE(sample, "") As sample, field FROM ?`, [[{"sample": null, "field": 'This is null.'}]]));In result we see "[{\"sample\":null,\"field\":\"This is null.\"}]".
JSON.stringify(alasql(`SELECT sample, field FROM ? WHERE NOT(sample IS NULL)`, [[{"sample": null, "field": 'This is null.'}]]));In result we see "[]".
JSON.stringify(alasql(`SELECT sample, field FROM ? WHERE sample IS NULL`, [[{"sample": null, "field": 'This is null.'}]]));In result we see "[{\"sample\":null,\"field\":\"This is null.\"}]".
Look like "sample": null isn't null. But sample IS NULL is true.
Source: AlaSQL/alasql