fix column COLLATE not displayed (#1012)

This commit is contained in:
Lukasz Stefaniak 2023-10-20 21:49:18 +02:00 committed by GitHub
parent c68e9775a2
commit 88510f6625
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -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}")?;
}

View file

@ -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\")");
}