Skip to content

UPDATE t SET a = DEFAULT writes undefined instead of the column default #2877

Closed

Description

@mathiasrw

UPDATE t SET a = DEFAULT writes undefined into the column instead of its default, without an error.

var db = new alasql.Database();
db.exec('CREATE TABLE t (a INT DEFAULT 5, b INT); INSERT INTO t VALUES (1, 1)');
db.exec('UPDATE t SET a = DEFAULT');
db.exec('SELECT * FROM t');
// [{b: 1}] (4.20.0: parse error)

Expected: [{a: 5, b: 1}].

Since #2683 (in 4.21.0), which made DEFAULT usable as a name: here it is read as a column named default, which does not exist. INSERT ... VALUES (DEFAULT, ...) throws a TypeError for the same reason (#2791). The fix: read DEFAULT as the column default in SET and in VALUES before it is read as a name, with a test for both.

Breaking?

No. Before #2683 it was a parse error.

Activity

  1. added a commit that references this issue on Oct 29, 2026
    c7410c8
  2. added a commit that references this issue on Nov 10, 2026
    e32a4e8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions