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.
The following works in MySQL to create a table with a specific schema while initialising it with data at the same time:
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
andINSERT 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.