Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(kingbase): skip incompatible schema object scans

zipg575f71dfd8ab
diff --git a/crates/dbx-core/src/transfer.rs b/crates/dbx-core/src/transfer.rs
index ea17574073..aeee7017eb 100644
--- a/crates/dbx-core/src/transfer.rs
+++ b/crates/dbx-core/src/transfer.rs
@@ -6357,7 +6357,19 @@ pub fn should_transfer_schema_objects(
return false;
}
if !objects.is_empty() {
- return true;
+ // A table-only selection is already handled by the table transfer pass.
+ // Do not enter the PostgreSQL-family schema-object path just because the
+ // request also carries the selected table kind. This matters for
+ // Kingbase, whose catalog is not a drop-in PostgreSQL catalog.
+ return objects
+ .iter()
+ .any(|selection| selection.object_type != TransferObjectKind::Table && !selection.names.is_empty());
+ }
+ if matches!(source_db_type, DatabaseType::Kingbase) || matches!(target_db_type, DatabaseType::Kingbase) {
+ // Kingbase V8 does not expose every PostgreSQL pg_catalog relation used
+ // by the optional object scanner. Empty selection means the legacy
+ // table-transfer request here, so avoid probing unsupported catalogs.
+ return false;
}
transfer_object_family(source_db_type) == Some(TransferObjectFamily::Postgres)
&& transfer_object_family(target_db_type) == Some(TransferObjectFamily::Postgres)
@@ -10634,12 +10646,24 @@ mod tests {
&TransferContent::StructureOnly,
&[]
));
- assert!(should_transfer_schema_objects(
+ assert!(!should_transfer_schema_objects(
&DatabaseType::Kingbase,
&DatabaseType::Postgres,
&TransferContent::StructureAndData,
&[]
));
+ assert!(!should_transfer_schema_objects(
+ &DatabaseType::Kingbase,
+ &DatabaseType::Kingbase,
+ &TransferContent::StructureAndData,
+ &[TransferObjectSelection { object_type: TransferObjectKind::Table, names: vec!["orders".into()] }]
+ ));
+ assert!(should_transfer_schema_objects(
+ &DatabaseType::Kingbase,
+ &DatabaseType::Kingbase,
+ &TransferContent::StructureOnly,
+ &[TransferObjectSelection { object_type: TransferObjectKind::View, names: vec!["v_orders".into()] }]
+ ));
assert!(should_transfer_schema_objects(
&DatabaseType::Postgres,
&DatabaseType::OpenGauss,