Parse an INSERT statement
(&mut self)
| 8595 | |
| 8596 | /// Parse an INSERT statement |
| 8597 | fn parse_insert(&mut self) -> Result<Statement<Raw>, ParserError> { |
| 8598 | self.expect_keyword(INTO)?; |
| 8599 | let table_name = self.parse_raw_name()?; |
| 8600 | let columns = self.parse_parenthesized_column_list(Optional)?; |
| 8601 | let source = if self.parse_keywords(&[DEFAULT, VALUES]) { |
| 8602 | InsertSource::DefaultValues |
| 8603 | } else { |
| 8604 | InsertSource::Query(self.parse_query()?) |
| 8605 | }; |
| 8606 | let returning = self.parse_returning()?; |
| 8607 | Ok(Statement::Insert(InsertStatement { |
| 8608 | table_name, |
| 8609 | columns, |
| 8610 | source, |
| 8611 | returning, |
| 8612 | })) |
| 8613 | } |
| 8614 | |
| 8615 | fn parse_returning(&mut self) -> Result<Vec<SelectItem<Raw>>, ParserError> { |
| 8616 | Ok(if self.parse_keyword(RETURNING) { |
no test coverage detected