mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 23:14:07 +00:00
Implement CREATE TABLE IF NOT EXISTS (#163)
A non-standard feature supported at least by Postgres https://www.postgresql.org/docs/12/sql-createtable.html
This commit is contained in:
parent
06865113d7
commit
5ad578e3e5
4 changed files with 62 additions and 1 deletions
|
@ -880,6 +880,7 @@ impl Parser {
|
|||
columns,
|
||||
constraints,
|
||||
with_options: vec![],
|
||||
if_not_exists: false,
|
||||
external: true,
|
||||
file_format: Some(file_format),
|
||||
location: Some(location),
|
||||
|
@ -932,6 +933,7 @@ impl Parser {
|
|||
}
|
||||
|
||||
pub fn parse_create_table(&mut self) -> Result<Statement, ParserError> {
|
||||
let if_not_exists = self.parse_keywords(vec!["IF", "NOT", "EXISTS"]);
|
||||
let table_name = self.parse_object_name()?;
|
||||
// parse optional column list (schema)
|
||||
let (columns, constraints) = self.parse_columns()?;
|
||||
|
@ -942,6 +944,7 @@ impl Parser {
|
|||
columns,
|
||||
constraints,
|
||||
with_options,
|
||||
if_not_exists,
|
||||
external: false,
|
||||
file_format: None,
|
||||
location: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue