Skip to content

Commit 8532dd3

Browse files
pr feedback: generic naming for syntax
1 parent d76a9c9 commit 8532dd3

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

src/ast/ddl.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,11 @@ pub enum AlterTableOperation {
352352
name: Ident,
353353
},
354354
/// `SET ( storage_parameter [= value] [, ... ] )`
355-
SetStorageParameters {
356-
storage_parameters: Vec<SqlOption>,
355+
///
356+
/// Note: this is a PostgreSQL-specific operation.
357+
/// Please refer to [PostgreSQL documentation](https://www.postgresql.org/docs/current/sql-altertable.html)
358+
SetOptionsParens {
359+
options: Vec<SqlOption>,
357360
},
358361
}
359362

@@ -795,8 +798,8 @@ impl fmt::Display for AlterTableOperation {
795798
AlterTableOperation::ValidateConstraint { name } => {
796799
write!(f, "VALIDATE CONSTRAINT {name}")
797800
}
798-
AlterTableOperation::SetStorageParameters { storage_parameters } => {
799-
write!(f, "SET ({})", display_comma_separated(storage_parameters))
801+
AlterTableOperation::SetOptionsParens { options } => {
802+
write!(f, "SET ({})", display_comma_separated(options))
800803
}
801804
}
802805
}

src/ast/spans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,8 +1201,8 @@ impl Spanned for AlterTableOperation {
12011201
AlterTableOperation::Lock { .. } => Span::empty(),
12021202
AlterTableOperation::ReplicaIdentity { .. } => Span::empty(),
12031203
AlterTableOperation::ValidateConstraint { name } => name.span,
1204-
AlterTableOperation::SetStorageParameters { storage_parameters } => {
1205-
union_spans(storage_parameters.iter().map(|i| i.span()))
1204+
AlterTableOperation::SetOptionsParens { options } => {
1205+
union_spans(options.iter().map(|i| i.span()))
12061206
}
12071207
}
12081208
}

src/parser/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8947,9 +8947,7 @@ impl<'a> Parser<'a> {
89478947
} else {
89488948
options = self.parse_options(Keyword::SET)?;
89498949
if !options.is_empty() {
8950-
AlterTableOperation::SetStorageParameters {
8951-
storage_parameters: options,
8952-
}
8950+
AlterTableOperation::SetOptionsParens { options }
89538951
} else {
89548952
return self.expected(
89558953
"ADD, RENAME, PARTITION, SWAP, DROP, REPLICA IDENTITY, SET, or SET TBLPROPERTIES after ALTER TABLE",

tests/sqlparser_common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4728,9 +4728,9 @@ fn parse_alter_table() {
47284728

47294729
let set_storage_parameters = "ALTER TABLE tab SET (autovacuum_vacuum_scale_factor = 0.01, autovacuum_vacuum_threshold = 500)";
47304730
match alter_table_op(verified_stmt(set_storage_parameters)) {
4731-
AlterTableOperation::SetStorageParameters { storage_parameters } => {
4731+
AlterTableOperation::SetOptionsParens { options } => {
47324732
assert_eq!(
4733-
storage_parameters,
4733+
options,
47344734
[
47354735
SqlOption::KeyValue {
47364736
key: Ident {

0 commit comments

Comments
 (0)