Skip to content

Dolt does not support CREATE TABLE ... AS ... with a table definition #7996

Description

@ecryth

The following works in MySQL to create a table with a specific schema while initialising it with data at the same time:

CREATE TEMPORARY TABLE tmp_test (
    `id` INT PRIMARY KEY
)
AS SELECT 1 `id`;

With Dolt, however, this results in a syntax error at position 64 near 'AS'.

It's trivial to work around by splitting it into separate CREATE TABLE and INSERT INTO statements, but you do lose some atomicity which would be nice to have in migrations.

Note that with MySQL, it seems you need to give the columns in the SELECT query explicit names in order to map them to the correct columns in the table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions