Postgresql: Add REPLICA IDENTITY operation for ALTER TABLE (#1844)

This commit is contained in:
Mohamed Abdeen 2025-05-14 08:40:44 +01:00 committed by GitHub
parent 74a95fdbd1
commit c6e897dc12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 80 additions and 2 deletions

View file

@ -5959,3 +5959,30 @@ fn parse_varbit_datatype() {
_ => unreachable!(),
}
}
#[test]
fn parse_alter_table_replica_identity() {
match pg_and_generic().verified_stmt("ALTER TABLE foo REPLICA IDENTITY FULL") {
Statement::AlterTable { operations, .. } => {
assert_eq!(
operations,
vec![AlterTableOperation::ReplicaIdentity {
identity: ReplicaIdentity::Full
}]
);
}
_ => unreachable!(),
}
match pg_and_generic().verified_stmt("ALTER TABLE foo REPLICA IDENTITY USING INDEX foo_idx") {
Statement::AlterTable { operations, .. } => {
assert_eq!(
operations,
vec![AlterTableOperation::ReplicaIdentity {
identity: ReplicaIdentity::Index("foo_idx".into())
}]
);
}
_ => unreachable!(),
}
}