mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-02 21:22:15 +00:00
Treat COLLATE like any other column option (#1731)
This commit is contained in:
parent
b482562618
commit
97f0be6991
13 changed files with 60 additions and 151 deletions
|
@ -1206,7 +1206,6 @@ impl fmt::Display for ProcedureParam {
|
|||
pub struct ColumnDef {
|
||||
pub name: Ident,
|
||||
pub data_type: DataType,
|
||||
pub collation: Option<ObjectName>,
|
||||
pub options: Vec<ColumnOptionDef>,
|
||||
}
|
||||
|
||||
|
@ -1217,9 +1216,6 @@ impl fmt::Display for ColumnDef {
|
|||
} else {
|
||||
write!(f, "{} {}", self.name, self.data_type)?;
|
||||
}
|
||||
if let Some(collation) = &self.collation {
|
||||
write!(f, " COLLATE {collation}")?;
|
||||
}
|
||||
for option in &self.options {
|
||||
write!(f, " {option}")?;
|
||||
}
|
||||
|
@ -1566,6 +1562,7 @@ pub enum ColumnOption {
|
|||
/// - ...
|
||||
DialectSpecific(Vec<Token>),
|
||||
CharacterSet(ObjectName),
|
||||
Collation(ObjectName),
|
||||
Comment(String),
|
||||
OnUpdate(Expr),
|
||||
/// `Generated`s are modifiers that follow a column definition in a `CREATE
|
||||
|
@ -1665,6 +1662,7 @@ impl fmt::Display for ColumnOption {
|
|||
Check(expr) => write!(f, "CHECK ({expr})"),
|
||||
DialectSpecific(val) => write!(f, "{}", display_separated(val, " ")),
|
||||
CharacterSet(n) => write!(f, "CHARACTER SET {n}"),
|
||||
Collation(n) => write!(f, "COLLATE {n}"),
|
||||
Comment(v) => write!(f, "COMMENT '{}'", escape_single_quote_string(v)),
|
||||
OnUpdate(expr) => write!(f, "ON UPDATE {expr}"),
|
||||
Generated {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue