Skip to content

DELETE and INSERT VALUES throw a TypeError when a scalar subquery reads a parameter #3138

Backlog

Description

@mathiasrw
alasql('CREATE TABLE t (a INT); INSERT INTO t VALUES (1),(2),(3)');
alasql('CREATE TABLE u (x INT); INSERT INTO u VALUES (1),(2)');
alasql('DELETE FROM t WHERE a = (SELECT MAX(x) FROM u WHERE x < ?)', [2]);
alasql('INSERT INTO t VALUES ((SELECT MAX(x) FROM u WHERE x < ?))', [2]);

Both throw TypeError: Cannot read properties of undefined (reading '0').

SQLite deletes the row 1 and then inserts 1.

Fixed by #2667.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions