diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs index f4b41d60b..0f50356d7 100644 --- a/src/ast/ddl.rs +++ b/src/ast/ddl.rs @@ -24,7 +24,10 @@ use serde::{Deserialize, Serialize}; use sqlparser_derive::{Visit, VisitMut}; use crate::ast::value::escape_single_quote_string; -use crate::ast::{display_comma_separated, display_separated, DataType, Expr, Ident, MySQLColumnPosition, ObjectName, SequenceOptions, SqlOption}; +use crate::ast::{ + display_comma_separated, display_separated, DataType, Expr, Ident, MySQLColumnPosition, + ObjectName, SequenceOptions, SqlOption, +}; use crate::tokenizer::Token; /// An `ALTER TABLE` (`Statement::AlterTable`) operation diff --git a/src/ast/mod.rs b/src/ast/mod.rs index 04de4ee14..ba01ec2df 100644 --- a/src/ast/mod.rs +++ b/src/ast/mod.rs @@ -34,8 +34,8 @@ pub use self::dcl::{AlterRoleOperation, ResetConfig, RoleOption, SetConfigValue} pub use self::ddl::{ AlterColumnOperation, AlterIndexOperation, AlterTableOperation, ColumnDef, ColumnOption, ColumnOptionDef, ConstraintCharacteristics, DeferrableInitial, GeneratedAs, - GeneratedExpressionMode, IndexOption, IndexType, KeyOrIndexDisplay, Owner, Partition, ProcedureParam, - ReferentialAction, TableConstraint, UserDefinedTypeCompositeAttributeDef, + GeneratedExpressionMode, IndexOption, IndexType, KeyOrIndexDisplay, Owner, Partition, + ProcedureParam, ReferentialAction, TableConstraint, UserDefinedTypeCompositeAttributeDef, UserDefinedTypeRepresentation, ViewColumnDef, }; pub use self::dml::{Delete, Insert}; diff --git a/src/parser/mod.rs b/src/parser/mod.rs index c331e639c..046b72aec 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -6272,7 +6272,9 @@ impl<'a> Parser<'a> { self.expect_keyword(Keyword::WITH)?; let table_name = self.parse_object_name(false)?; AlterTableOperation::SwapWith { table_name } - } else if dialect_of!(self is PostgreSqlDialect) && self.parse_keywords(&[Keyword::OWNER, Keyword::TO]) { + } else if dialect_of!(self is PostgreSqlDialect) + && self.parse_keywords(&[Keyword::OWNER, Keyword::TO]) + { let next_token = self.next_token(); let new_owner = match next_token.token { Token::DoubleQuotedString(ref s) => Owner::Ident(Ident::new(s.to_string())), diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs index 3760c4bb5..70a225b8c 100644 --- a/tests/sqlparser_postgres.rs +++ b/tests/sqlparser_postgres.rs @@ -774,7 +774,12 @@ fn parse_alter_table_owner_to() { location: _, } => { assert_eq!(name.to_string(), "tab"); - assert_eq!(operations, vec![AlterTableOperation::OwnerTo { new_owner: case.expected_owner.clone() }]); + assert_eq!( + operations, + vec![AlterTableOperation::OwnerTo { + new_owner: case.expected_owner.clone() + }] + ); } _ => unreachable!("Expected an AlterTable statement"), }