🐛 fix(postgres): 修复 LIKE 'pg_%' 误匹配 pgsrpschema 等非系统 schema

LIKE 模式中 '_' 是单字符通配符,'pg_%' 不仅匹配 pg_catalog/pg_toast,
还会匹配 pgsrpschema 等以 'pgs' 开头的 schema,导致这些 schema
下的表被 GetTables 漏掉,侧边栏不显示 schema 分组。
改用 LIKE 'pg|_%' ESCAPE '|','_' 仅匹配字面量下划线。
This commit is contained in:
Jia Sui
2026-05-09 19:09:35 +08:00
parent baed7a2721
commit 741fba4c27
6 changed files with 16 additions and 16 deletions

View File

@@ -608,7 +608,7 @@ func (d *OptionalDriverAgentDB) ensureKingbaseSearchPath(config connection.Conne
func (d *OptionalDriverAgentDB) listKingbaseSchemas(ctx context.Context) ([]string, error) {
query := `SELECT nspname FROM pg_namespace
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND nspname NOT LIKE 'pg_%'
AND nspname NOT LIKE 'pg|_%' ESCAPE '|'
ORDER BY nspname`
rows, _, err := d.QueryContext(ctx, query)
if err != nil {