Skip to content

Commit 3a95287

Browse files
committed
fix(replication): Handle unquoted RDS tablespace references
Extended tablespace filtering to catch unquoted references like: - SECURITY LABEL ON TABLESPACE rds_temp_tablespace - GRANT ON TABLESPACE rds_temp_tablespace - REVOKE ON TABLESPACE rds_temp_tablespace Previously only quoted forms ('rds_*' and "rds_*") were filtered. Now also matches "tablespace rds_" pattern for bare identifiers.
1 parent 697434b commit 3a95287

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [5.3.9] - 2025-12-02
6+
7+
### Fixed
8+
9+
- **Handle unquoted RDS tablespace references**: Extended tablespace filtering to also catch unquoted references like `SECURITY LABEL ON TABLESPACE rds_temp_tablespace` and `GRANT ON TABLESPACE rds_temp_tablespace`. Previously only quoted forms (`'rds_*'` and `"rds_*"`) were filtered.
10+
511
## [5.3.8] - 2025-12-02
612

713
### Fixed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "database-replicator"
3-
version = "5.3.8"
3+
version = "5.3.9"
44
edition = "2021"
55
license = "Apache-2.0"
66
description = "Universal database-to-PostgreSQL replication CLI. Supports PostgreSQL, SQLite, MongoDB, and MySQL."

src/migration/dump.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ pub fn remove_restricted_guc_settings(path: &str) -> Result<()> {
174174
/// This function filters out:
175175
/// - `CREATE TABLESPACE` statements
176176
/// - Any statement referencing RDS-specific tablespaces (any `rds_*` tablespace)
177+
/// including quoted ('rds_*', "rds_*") and unquoted (TABLESPACE rds_*) forms
177178
pub fn remove_tablespace_statements(path: &str) -> Result<()> {
178179
let content = fs::read_to_string(path)
179180
.with_context(|| format!("Failed to read globals dump at {}", path))?;
@@ -188,9 +189,14 @@ pub fn remove_tablespace_statements(path: &str) -> Result<()> {
188189
let is_create_tablespace = lower_trimmed.starts_with("create tablespace");
189190

190191
// Filter any statement referencing RDS tablespaces (rds_* pattern)
191-
// Matches 'rds_something' or "rds_something" in SQL statements
192-
let references_rds_tablespace =
193-
lower_trimmed.contains("'rds_") || lower_trimmed.contains("\"rds_");
192+
// Matches:
193+
// - 'rds_something' (single quoted)
194+
// - "rds_something" (double quoted)
195+
// - TABLESPACE rds_something (unquoted, e.g., SECURITY LABEL ON TABLESPACE rds_temp_tablespace)
196+
// - GRANT/REVOKE ON TABLESPACE rds_something
197+
let references_rds_tablespace = lower_trimmed.contains("'rds_")
198+
|| lower_trimmed.contains("\"rds_")
199+
|| lower_trimmed.contains("tablespace rds_");
194200

195201
if is_create_tablespace || references_rds_tablespace {
196202
updated.push_str("-- ");

0 commit comments

Comments
 (0)