From 49f0d4e50318fb9ad6677fffe891da5edb67513a Mon Sep 17 00:00:00 2001 From: MemRelay Date: Wed, 11 Nov 2026 02:45:22 +0800 Subject: [PATCH] =?UTF-8?q?create:=20PostgreSQL=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E6=93=8D=E4=BD=9C=E5=BF=85=E9=A1=BB=E5=B8=A6=20catalo?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MemRelay-Operation: memory-save:exp-pg-catalog-every-operation-20261111 MemRelay-Resource: 6e1edb3c-5940-47a0-a53c-c16ff4bbd996 --- .../PostgreSQL 数据库操作必须带 catalog.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/d5a7f581-c442-4554-87b9-ee723b8b0258/PostgreSQL 数据库操作必须带 catalog.md diff --git a/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/PostgreSQL 数据库操作必须带 catalog.md b/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/PostgreSQL 数据库操作必须带 catalog.md new file mode 100644 index 0000000..83608fa --- /dev/null +++ b/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/PostgreSQL 数据库操作必须带 catalog.md @@ -0,0 +1,21 @@ +--- +title: PostgreSQL 数据库操作必须带 catalog +type: experience +permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/postgre-sql-数据库操作必须带-catalog +stable_id: 6e1edb3c-5940-47a0-a53c-c16ff4bbd996 +scope: project +memory_type: experience +project_id: d5a7f581-c442-4554-87b9-ee723b8b0258 +usage_profile_id: 0c9feb46-d06e-43cd-9ef0-c5813c84a998 +status: active +revision: 1 +request_id: exp-pg-catalog-every-operation-20261111 +created_at: '2026-11-10T18:45:19.933980+00:00' +updated_at: '2026-11-10T18:45:19.933980+00:00' +tags: +- database +- postgresql +- mysql +--- + +数据库管理里 PostgreSQL 一个连接下有多个库(catalog),树结构是 catalog > schema > 表。任何会连接数据库的接口都要把 catalog 传到 DatabaseService._runtime / ExternalDatabase,否则会连到连接的默认库,表现为「SQL 执行失败」。新增请求模型继承 schemas.CatalogScoped;GET/DELETE 接口加 catalog 查询参数;前端用 tab.catalog 或 selectedCatalog。catalog 只在 create_external_engine 的 PostgreSQL 分支生效,MySQL/MariaDB 传空或任意值都被忽略。改动后用 METRIX_TEST_PG_URL 和 METRIX_TEST_MYSQL_URL 指向临时容器跑在线测试。 \ No newline at end of file