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:
Alex Dukhno 2020-04-21 16:28:02 +03:00 committed by GitHub
parent 06865113d7
commit 5ad578e3e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 1 deletions

View file

@ -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,