sql-parser icon indicating copy to clipboard operation
sql-parser copied to clipboard

Add support for CREATE TABLE tbl AS query_expression

Open stevenwdv opened this issue 8 years ago • 1 comments

Currently the parser does not recognize CREATE TABLE statements in the form of CREATE TABLE tbl AS (SELECT 1).

Relevant syntax (link):

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
    [(create_definition,...)]
    [table_options]
    [partition_options]
    [IGNORE | REPLACE]
    [AS] query_expression  #<<<

phpMyAdmin version: 4.7.4

stevenwdv avatar Sep 04 '17 19:09 stevenwdv

Confirmed on current master:

$ ./bin/lint-query --query 'CREATE TABLE tbl AS (SELECT 1)'
#1: An opening bracket was expected. (near "AS" at position 17)
#2: At least one column definition was expected. (near " " at position 16)
#3: Unexpected token. (near ")" at position 29)

nijel avatar Sep 05 '17 10:09 nijel