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 @@ -24,3 +24,4 @@ ALTER EXTENSION citext DROP INDEX public.idx;
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;
3 changes: 3 additions & 0 deletions src/ast/ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4969,6 +4969,8 @@ pub enum AlterExtensionMember {
Server(Ident),
/// `STATISTICS object_name`
Statistics(ObjectName),
/// `SUBSCRIPTION object_name`
Subscription(Ident),
/// `TABLE object_name`
Table(ObjectName),
/// `TEXT SEARCH CONFIGURATION object_name`
Expand Down Expand Up @@ -5030,6 +5032,7 @@ impl fmt::Display for AlterExtensionMember {
AlterExtensionMember::Sequence(name) => write!(f, "SEQUENCE {name}"),
AlterExtensionMember::Server(name) => write!(f, "SERVER {name}"),
AlterExtensionMember::Statistics(name) => write!(f, "STATISTICS {name}"),
AlterExtensionMember::Subscription(name) => write!(f, "SUBSCRIPTION {name}"),
AlterExtensionMember::Table(name) => write!(f, "TABLE {name}"),
AlterExtensionMember::TextSearchConfiguration(name) => {
write!(f, "TEXT SEARCH CONFIGURATION {name}")
Expand Down
1 change: 1 addition & 0 deletions src/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ define_keywords!(
STYPE,
SUBMULTISET,
SUBSCRIPT,
SUBSCRIPTION,
SUBSTR,
SUBSTRING,
SUBSTRING_REGEX,
Expand Down
2 changes: 2 additions & 0 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12595,6 +12595,8 @@ impl<'a> Parser<'a> {
Ok(AlterExtensionMember::Statistics(
self.parse_object_name(false)?,
))
} else if self.parse_keyword(Keyword::SUBSCRIPTION) {
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_keywords(&[Keyword::TEXT, Keyword::SEARCH, Keyword::CONFIGURATION]) {
Expand Down
2 changes: 2 additions & 0 deletions tests/sqlparser_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13548,6 +13548,7 @@ fn alter_extension_member_round_trip_forms(action: &str) {
format!("ALTER EXTENSION ext_name {action} SEQUENCE seq"),
format!("ALTER EXTENSION ext_name {action} SERVER srv"),
format!("ALTER EXTENSION ext_name {action} STATISTICS stats"),
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} TEXT SEARCH CONFIGURATION cfg"),
Expand Down Expand Up @@ -13748,6 +13749,7 @@ fn parse_alter_extension_add_member() {
"SEQUENCE",
"SERVER",
"STATISTICS",
"SUBSCRIPTION",
"TABLE",
"TEXT SEARCH CONFIGURATION",
"TEXT SEARCH DICTIONARY",
Expand Down
Loading