From a052bcd2cda32687fc2e5ac6a1ae6e5f41b4e91d Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Wed, 17 Jun 2026 01:40:06 +0800 Subject: [PATCH] fix(jdbc): pass through JDBC identifiers unquoted in frontend --- apps/desktop/src/lib/tableSelectSql.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/desktop/src/lib/tableSelectSql.ts b/apps/desktop/src/lib/tableSelectSql.ts index f409648d9..637168ac8 100644 --- a/apps/desktop/src/lib/tableSelectSql.ts +++ b/apps/desktop/src/lib/tableSelectSql.ts @@ -18,7 +18,9 @@ export interface BuildTableSelectSqlOptions { export function quoteTableIdentifier(databaseType: DatabaseType | undefined, name: string): string { if (databaseType === "iotdb") return name; - if (databaseType === "jdbc") return quoteJdbcIdentifier(name); + // JDBC connections use the driver-reported identifier quote string + // (DatabaseMetaData.getIdentifierQuoteString()) — pass through unquoted. + if (databaseType === "jdbc") return name; if (databaseType === "mysql" || databaseType === "hive" || databaseType === "databend" || databaseType === "tdengine" || databaseType === "access") return `\`${name.replace(/`/g, "``")}\``; if (databaseType === "informix" && /^[A-Za-z_][A-Za-z0-9_$]*$/.test(name)) return name; if (databaseType === "neo4j") return quoteCypherIdentifier(name); @@ -30,11 +32,6 @@ function quoteCypherIdentifier(name: string): string { return `\`${name.replace(/`/g, "``")}\``; } -function quoteJdbcIdentifier(name: string): string { - if (/^[A-Za-z_][A-Za-z0-9_$]*$/.test(name)) return name; - return `\`${name.replace(/`/g, "``")}\``; -} - export function qualifiedTableName(options: Pick): string { const { databaseType, schema, tableName } = options; if (databaseType === "iotdb") {