Files
MemRelay/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/PostgreSQL 数据库操作必须带 catalog.md
T
memrelay 49f0d4e503 create: PostgreSQL 数据库操作必须带 catalog
MemRelay-Operation: memory-save:exp-pg-catalog-every-operation-20261111
MemRelay-Resource: 6e1edb3c-5940-47a0-a53c-c16ff4bbd996
2026-11-11 02:45:22 +08:00

21 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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 指向临时容器跑在线测试。