Support arbitrary INSERT sources

INSERT takes arbitrary queries as sources, not just VALUES clauses. For
example, `INSERT INTO foo SELECT * FROM bar` is perfectly valid.
This commit is contained in:
Nikhil Benesch 2019-05-28 19:37:00 -04:00
parent 9420070a0d
commit 14e07ebdda
No known key found for this signature in database
GPG key ID: F7386C5DEADABA7F
3 changed files with 17 additions and 11 deletions

View file

@ -1565,12 +1565,11 @@ impl Parser {
self.expect_keyword("INTO")?;
let table_name = self.parse_object_name()?;
let columns = self.parse_parenthesized_column_list(Optional)?;
self.expect_keyword("VALUES")?;
let values = self.parse_values()?;
let source = Box::new(self.parse_query()?);
Ok(SQLStatement::SQLInsert {
table_name,
columns,
values,
source,
})
}