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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(schema): default to public schema for PG and database for MySQL when schema is empty
runstone61b5e907ce20
diff --git a/crates/dbx-core/src/db/postgres.rs b/crates/dbx-core/src/db/postgres.rsindex 400e6f8f18..d2d049fda0 100644--- a/crates/dbx-core/src/db/postgres.rs+++ b/crates/dbx-core/src/db/postgres.rs@@ -1114,6 +1114,7 @@ pub async fn list_databases(pool: &Pool) -> Result<Vec<DatabaseInfo>, String> {}pub async fn list_tables(pool: &Pool, schema: &str) -> Result<Vec<TableInfo>, String> {+ let schema = if schema.is_empty() { "public" } else { schema };let client = pool.get().await.map_err(|e| e.to_string())?;let stmt = client.prepare_cached(postgres_tables_sql()).await.map_err(|e| e.to_string())?;let rows = client.query(&stmt, &[&schema]).await.map_err(|e| e.to_string())?;@@ -1492,6 +1493,7 @@ async fn get_columns_with_sql(}pub async fn get_columns(pool: &Pool, schema: &str, table: &str) -> Result<Vec<ColumnInfo>, String> {+ let schema = if schema.is_empty() { "public" } else { schema };let client = pool.get().await.map_err(|e| e.to_string())?;match get_columns_with_sql(&client, POSTGRES_COLUMNS_SQL, schema, table).await {Ok(columns) => Ok(columns),diff --git a/crates/dbx-core/src/schema/providers/native.rs b/crates/dbx-core/src/schema/providers/native.rsindex 816e6cb27a..013e3a6fa9 100644--- a/crates/dbx-core/src/schema/providers/native.rs+++ b/crates/dbx-core/src/schema/providers/native.rs@@ -35,8 +35,14 @@ pub(in crate::schema) async fn list_tables(PoolKind::Mysql(p, _) if config.is_some_and(is_doris_family_config) => {db::mysql::list_tables_show(p, database).await}- PoolKind::Mysql(p, mode) if *mode == MysqlMode::OceanBaseOracle => db::ob_oracle::list_tables(p, schema).await,- PoolKind::Mysql(p, _) => db::mysql::list_tables(p, schema).await,+ PoolKind::Mysql(p, mode) if *mode == MysqlMode::OceanBaseOracle => {+ let s = if schema.is_empty() { database } else { schema };+ db::ob_oracle::list_tables(p, s).await+ }+ PoolKind::Mysql(p, _) => {+ let db = if schema.is_empty() { database } else { schema };+ db::mysql::list_tables(p, db).await+ }PoolKind::Postgres(p) => db::postgres::list_tables(p, schema).await,PoolKind::Sqlite(p) => db::sqlite::list_tables(p, schema).await,PoolKind::Rqlite(client) => db::rqlite_driver::list_tables(client, schema).await,