mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
feat: support postgres alter schema (#2038)
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
This commit is contained in:
parent
ea7f9026f7
commit
0b723147b6
4 changed files with 87 additions and 1 deletions
|
@ -6576,3 +6576,66 @@ fn parse_create_server() {
|
|||
assert_eq!(stmt, expected);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_alter_schema() {
|
||||
match pg_and_generic().verified_stmt("ALTER SCHEMA foo RENAME TO bar") {
|
||||
Statement::AlterSchema(AlterSchema { operations, .. }) => {
|
||||
assert_eq!(
|
||||
operations,
|
||||
vec![AlterSchemaOperation::Rename {
|
||||
name: ObjectName::from(vec!["bar".into()])
|
||||
}]
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
match pg_and_generic().verified_stmt("ALTER SCHEMA foo OWNER TO bar") {
|
||||
Statement::AlterSchema(AlterSchema { operations, .. }) => {
|
||||
assert_eq!(
|
||||
operations,
|
||||
vec![AlterSchemaOperation::OwnerTo {
|
||||
owner: Owner::Ident("bar".into())
|
||||
}]
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
match pg_and_generic().verified_stmt("ALTER SCHEMA foo OWNER TO CURRENT_ROLE") {
|
||||
Statement::AlterSchema(AlterSchema { operations, .. }) => {
|
||||
assert_eq!(
|
||||
operations,
|
||||
vec![AlterSchemaOperation::OwnerTo {
|
||||
owner: Owner::CurrentRole
|
||||
}]
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
match pg_and_generic().verified_stmt("ALTER SCHEMA foo OWNER TO CURRENT_USER") {
|
||||
Statement::AlterSchema(AlterSchema { operations, .. }) => {
|
||||
assert_eq!(
|
||||
operations,
|
||||
vec![AlterSchemaOperation::OwnerTo {
|
||||
owner: Owner::CurrentUser
|
||||
}]
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
match pg_and_generic().verified_stmt("ALTER SCHEMA foo OWNER TO SESSION_USER") {
|
||||
Statement::AlterSchema(AlterSchema { operations, .. }) => {
|
||||
assert_eq!(
|
||||
operations,
|
||||
vec![AlterSchemaOperation::OwnerTo {
|
||||
owner: Owner::SessionUser
|
||||
}]
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue