Skip to content

PREPARE, EXECUTE and DEALLOCATE PREPARE are parse errors #2863

Open

Description

@mathiasrw

Prepared statements in SQL are parse errors: PREPARE name FROM 'text', EXECUTE name [USING @var, ...] and DEALLOCATE PREPARE name.

Seen in the MySQL server tests run (alasql-mysqltest): 13,462 statements in 204 files (ps.test, ps_1general.test, and many tests that run each query again as a prepared statement). Reproduced with alasql 4.21.0:

alasql('CREATE TABLE t1 (a INT)');
alasql('INSERT INTO t1 VALUES (1), (2)');
alasql("PREPARE stmt FROM 'SELECT a FROM t1 WHERE a = ?'");   // Parse error
alasql('SET @x = 2');
alasql('EXECUTE stmt USING @x');                              // Parse error
alasql('DEALLOCATE PREPARE stmt');                            // Parse error

Expected: EXECUTE stmt USING @x gives [{a: 2}]. AlaSQL already compiles statements with ? parameters (alasql.compile), so these statements can use that.

Breaking?

No. Today these are parse errors.

This holds as long as the new words PREPARE and DEALLOCATE stay usable as names, so that SELECT prepare FROM t on a column called prepare 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. mateuscmtropical commented on Nov 11, 2026

    @mateuscmtropical
    Contributor

    Hi, I'd like to work on this one.

  3. mateuscmtropical commented on Nov 11, 2026

    @mateuscmtropical
    Contributor

    Hi, I've opened a PR for this: #3038

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