fix(jdbc): avoid double quoting kyuubi identifiers

This commit is contained in:
t8y2 committed 2026-06-03 17:48:03 +08:00
1 parent 0f40f6cd0c
commit 573f31c8dc
3 files changed
+51

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
import { strict as assert } from "node:assert";
import test from "node:test";
import { qualifiedTableName, quoteTableIdentifier } from "../../apps/desktop/src/lib/tableSelectSql.ts";
test("JDBC table identifiers avoid double quotes for Kyuubi-compatible names", () => {
assert.equal(quoteTableIdentifier("jdbc", "cbsdw_dwd"), "cbsdw_dwd");
assert.equal(quoteTableIdentifier("jdbc", "dwd_test_df"), "dwd_test_df");
assert.equal(
qualifiedTableName({ databaseType: "jdbc", schema: "cbsdw_dwd", tableName: "dwd_test_df" }),
"cbsdw_dwd.dwd_test_df",
);
});
test("JDBC table identifiers use backticks only when quoting is needed", () => {
assert.equal(quoteTableIdentifier("jdbc", "daily orders"), "`daily orders`");
assert.equal(quoteTableIdentifier("jdbc", "daily`orders"), "`daily``orders`");
});