Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fuzz/fuzz_seeds/postgres_alter_extension.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ ALTER EXTENSION citext ADD PUBLICATION pub;
ALTER EXTENSION citext ADD ROLE role_name;
ALTER EXTENSION citext DROP STATISTICS public.st;
ALTER EXTENSION citext DROP SUBSCRIPTION sub;
ALTER EXTENSION citext ADD TABLESPACE ts;
3 changes: 3 additions & 0 deletions src/ast/ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4973,6 +4973,8 @@ pub enum AlterExtensionMember {
Subscription(Ident),
/// `TABLE object_name`
Table(ObjectName),
/// `TABLESPACE object_name`
TableSpace(Ident),
/// `TEXT SEARCH CONFIGURATION object_name`
TextSearchConfiguration(ObjectName),
/// `TEXT SEARCH DICTIONARY object_name`
Expand Down Expand Up @@ -5034,6 +5036,7 @@ impl fmt::Display for AlterExtensionMember {
AlterExtensionMember::Statistics(name) => write!(f, "STATISTICS {name}"),
AlterExtensionMember::Subscription(name) => write!(f, "SUBSCRIPTION {name}"),
AlterExtensionMember::Table(name) => write!(f, "TABLE {name}"),
AlterExtensionMember::TableSpace(name) => write!(f, "TABLESPACE {name}"),
AlterExtensionMember::TextSearchConfiguration(name) => {
write!(f, "TEXT SEARCH CONFIGURATION {name}")
}
Expand Down
2 changes: 2 additions & 0 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12599,6 +12599,8 @@ impl<'a> Parser<'a> {
Ok(AlterExtensionMember::Subscription(self.parse_identifier()?))
} else if self.parse_keyword(Keyword::TABLE) {
Ok(AlterExtensionMember::Table(self.parse_object_name(false)?))
} else if self.parse_keyword(Keyword::TABLESPACE) {
Ok(AlterExtensionMember::TableSpace(self.parse_identifier()?))
} else if self.parse_keywords(&[Keyword::TEXT, Keyword::SEARCH, Keyword::CONFIGURATION]) {
Ok(AlterExtensionMember::TextSearchConfiguration(
self.parse_object_name(false)?,
Expand Down
2 changes: 2 additions & 0 deletions tests/sqlparser_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13551,6 +13551,7 @@ fn alter_extension_member_round_trip_forms(action: &str) {
format!("ALTER EXTENSION ext_name {action} SUBSCRIPTION sub"),
format!("ALTER EXTENSION ext_name {action} TABLE t"),
format!("ALTER EXTENSION ext_name {action} TABLE schema.t"),
format!("ALTER EXTENSION ext_name {action} TABLESPACE ts"),
format!("ALTER EXTENSION ext_name {action} TEXT SEARCH CONFIGURATION cfg"),
format!("ALTER EXTENSION ext_name {action} TEXT SEARCH DICTIONARY dict"),
format!("ALTER EXTENSION ext_name {action} TEXT SEARCH PARSER pgrm"),
Expand Down Expand Up @@ -13751,6 +13752,7 @@ fn parse_alter_extension_add_member() {
"STATISTICS",
"SUBSCRIPTION",
"TABLE",
"TABLESPACE",
"TEXT SEARCH CONFIGURATION",
"TEXT SEARCH DICTIONARY",
"TEXT SEARCH PARSER",
Expand Down
Loading