🐛 fix(vastbase): 修复含点表名误识别为模式 (#757)

- 对含点号或双引号的 PostgreSQL-like 标识符进行可逆引用
- 让 Vastbase 表列表复用统一的 PostgreSQL 元数据解析
- 增加含点表名保持标识符边界的回归测试

Refs #757
This commit is contained in:
Syngnat
2026-07-30 15:59:28 +08:00
parent b64c7e92d1
commit bf3f221857
3 changed files with 24 additions and 17 deletions

View File

@@ -379,9 +379,9 @@ func parsePostgresTableNames(data []map[string]interface{}) []string {
if name == "" {
continue
}
table := name
table := encodePGLikeQualifiedNamePart(name)
if schema != "" {
table = fmt.Sprintf("%s.%s", schema, name)
table = fmt.Sprintf("%s.%s", encodePGLikeQualifiedNamePart(schema), table)
}
key := strings.ToLower(table)
if _, exists := seen[key]; exists {
@@ -393,6 +393,13 @@ func parsePostgresTableNames(data []map[string]interface{}) []string {
return tables
}
func encodePGLikeQualifiedNamePart(identifier string) string {
if !strings.ContainsAny(identifier, `."`) {
return identifier
}
return `"` + strings.ReplaceAll(identifier, `"`, `""`) + `"`
}
func (p *PostgresDB) GetCreateStatement(dbName, tableName string) (string, error) {
return fmt.Sprintf("-- SHOW CREATE TABLE not fully supported for PostgreSQL in this MVP.\n-- Table: %s", tableName), nil
}