mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-12-23 11:12:51 +00:00
Allow foreign table constraint without columns (#1608)
This commit is contained in:
parent
fac84d81ee
commit
6523dabcf8
3 changed files with 6 additions and 3 deletions
|
|
@ -885,12 +885,14 @@ impl fmt::Display for TableConstraint {
|
|||
} => {
|
||||
write!(
|
||||
f,
|
||||
"{}FOREIGN KEY ({}) REFERENCES {}({})",
|
||||
"{}FOREIGN KEY ({}) REFERENCES {}",
|
||||
display_constraint_name(name),
|
||||
display_comma_separated(columns),
|
||||
foreign_table,
|
||||
display_comma_separated(referred_columns),
|
||||
)?;
|
||||
if !referred_columns.is_empty() {
|
||||
write!(f, "({})", display_comma_separated(referred_columns))?;
|
||||
}
|
||||
if let Some(action) = on_delete {
|
||||
write!(f, " ON DELETE {action}")?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6830,7 +6830,7 @@ impl<'a> Parser<'a> {
|
|||
let columns = self.parse_parenthesized_column_list(Mandatory, false)?;
|
||||
self.expect_keyword(Keyword::REFERENCES)?;
|
||||
let foreign_table = self.parse_object_name(false)?;
|
||||
let referred_columns = self.parse_parenthesized_column_list(Mandatory, false)?;
|
||||
let referred_columns = self.parse_parenthesized_column_list(Optional, false)?;
|
||||
let mut on_delete = None;
|
||||
let mut on_update = None;
|
||||
loop {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue