Skip to content

FROM DUAL is "Table does not exist: DUAL" #2860

Closed

Description

@mathiasrw

FROM DUAL is "Table does not exist: DUAL". In MySQL and Oracle DUAL is a table of one row for a SELECT that needs no table; SELECT 1 + 1 without FROM works in AlaSQL already.

Seen in the MySQL server tests run (alasql-mysqltest): 313 statements in 61 files, for example SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL. Reproduced with alasql 4.21.0:

alasql('SELECT 1 + 1 AS x');              // [{x: 2}]
alasql('SELECT 1 + 1 AS x FROM DUAL');    // Table does not exist: DUAL
alasql('CREATE TABLE dual (x INT)');
alasql('INSERT INTO dual VALUES (5)');
alasql('SELECT x FROM dual');             // [{x: 5}]: a table named dual works

Expected: FROM DUAL is the same as no FROM.

Breaking?

No, if DUAL means the one-row table only when the database has no table named dual, so the last query keeps its result.

This holds as long as the new word DUAL stays usable as a name, so that SELECT dual FROM t on a column called dual keeps working. #2627 is the list of keywords made usable as names this way.

Activity

  1. modified the milestones: v5.x Focus, v5.0.0 on Oct 22, 2026
  2. thelastbackspace commented on Nov 5, 2026

    @thelastbackspace
    Contributor

    I'd like to take this one. I'm planning to treat a lone FROM DUAL as no FROM at compile time, but only when the database has no table called dual. A real dual table and a column named dual would keep working the way they do now.

  3. added a commit that references this issue on Nov 8, 2026
    367b957
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions