Skip to content

Commit

Permalink
fix column COLLATE not displayed (#1012)
Browse files Browse the repository at this point in the history
  • Loading branch information
lustefaniak authored Oct 20, 2023
1 parent c68e977 commit 88510f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ast/ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ pub struct ColumnDef {
impl fmt::Display for ColumnDef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
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}")?;
}
Expand Down
5 changes: 5 additions & 0 deletions tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7635,3 +7635,8 @@ fn parse_create_type() {
create_type
);
}

#[test]
fn parse_create_table_collate() {
pg_and_generic().verified_stmt("CREATE TABLE tbl (foo INT, bar TEXT COLLATE \"de_DE\")");
}

0 comments on commit 88510f6

Please sign in to comment.