Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INSERT multiple rows is not supported #162

Open
cdmh opened this issue Oct 21, 2020 · 4 comments
Open

INSERT multiple rows is not supported #162

cdmh opened this issue Oct 21, 2020 · 4 comments

Comments

@cdmh
Copy link
Contributor

cdmh commented Oct 21, 2020

A SQL statement to insert multiple rows into a table fails parsing

INSERT INTO links (url, name) VALUES ('https://www.google.com','Google'), ('https://www.yahoo.com','Yahoo'),('https://www.bing.com','Bing');

Produces an error at the end of the first pair of parentheses in the VALUES clause
hsql::SQLParserResult::errorColumn_ == 73
hsql::SQLParserResult::errorMsg_ == "syntax error, unexpected ',', expecting end of file"

@mrks
Copy link
Member

mrks commented Oct 21, 2020

I can only confirm this. The insert_statement does not support multiple values:

insert_statement:
INSERT INTO table_name opt_column_list VALUES '(' literal_list ')' {
$$ = new InsertStatement(kInsertValues);
$$->schema = $3.schema;
$$->tableName = $3.name;
$$->columns = $4;
$$->values = $7;

To our defense, this is not supported by SQL-92, which we use as orientation, either:

         <insert columns and source> ::=
                [ <left paren> <insert column list> <right paren> ]
              <query expression>
              | DEFAULT VALUES

         2) An <insert columns and source> that specifies DEFAULT VALUES is
            equivalent to an <insert columns and source> that specifies a
            <query expression> of the form

              VALUES (DEFAULT, . . . )

            where the number of "DEFAULT" entries is equal to the number of
            columns of T.

That being said, this is a valuable suggestion and I would support adding it. Due to a lack of resources, adding this might take us a while. External contributions are of course welcomed.

@cdmh
Copy link
Contributor Author

cdmh commented Oct 21, 2020

Thanks for the quick response! I’m not familiar with the standards, so didn’t appreciate this is an extension, although widely supported.

I don’t have experience with parsers, but maybe I’ll give it a go and see if I can work out how to support this.

@mrks
Copy link
Member

mrks commented Oct 21, 2020

It might have come in with a newer SQL standard. SQL-92 is just the one that is sufficient for our purposes. I do wish we could upgrade to a more comprehensive support of a newer version.

@cdmh cdmh changed the title INSERT multiple rows fails INSERT multiple rows not supported Oct 21, 2020
@cdmh cdmh changed the title INSERT multiple rows not supported INSERT multiple rows Is not supported Oct 21, 2020
@cdmh cdmh changed the title INSERT multiple rows Is not supported INSERT multiple rows is not supported Oct 21, 2020
@fowuyu
Copy link

fowuyu commented Nov 13, 2020

I also hope hyrise has this feature, it is usefull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants