25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(sidebar): respect identifier quote setting when creating views
U19c22856285e8
diff --git a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vueindex 036ab72e5a..f0c188b924 100644--- a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue+++ b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue@@ -4493,6 +4493,8 @@ function createView() {identifierQuote: connectionStore.connectionIdentifierQuote?.(node.connectionId),schema: node.schema,tableName: viewName,+ includeDatabaseName: settingsStore.editorSettings.generateSqlIncludeDatabaseName,+ quoteIdentifiers: settingsStore.editorSettings.generateSqlQuoteIdentifiers,});const tabId = queryStore.createTab(node.connectionId, node.database, t("contextMenu.createView"), "query", node.schema, undefined, node.catalog);queryStore.updateSql(tabId, `CREATE VIEW ${viewSqlName} AS\nSELECT\n *\nFROM table_name;\n`);diff --git a/apps/desktop/src/components/sidebar/__tests__/SidebarTreeRuntimeHost.createViewQuoteSetting.spec.ts b/apps/desktop/src/components/sidebar/__tests__/SidebarTreeRuntimeHost.createViewQuoteSetting.spec.tsnew file mode 100644index 0000000000..e8c0286af7--- /dev/null+++ b/apps/desktop/src/components/sidebar/__tests__/SidebarTreeRuntimeHost.createViewQuoteSetting.spec.ts@@ -0,0 +1,27 @@+import { readFileSync } from "node:fs";+import { fileURLToPath } from "node:url";+import { describe, expect, it } from "vitest";++const runtimeSource = readFileSync(fileURLToPath(new URL("../SidebarTreeRuntimeHost.vue", import.meta.url)), "utf8");++function functionSource(name: string): string {+ const start = runtimeSource.indexOf(`function ${name}(`);+ expect(start, `${name} not found`).toBeGreaterThan(-1);+ const next = runtimeSource.indexOf("\nfunction ", start + 1);+ return runtimeSource.slice(start, next === -1 ? undefined : next);+}++describe("SidebarTreeRuntimeHost createView identifier quoting (#9099)", () => {+ it("forwards the generate-SQL settings to qualifiedTableName", () => {+ const createView = functionSource("createView");+ const callStart = createView.indexOf("qualifiedTableName({");+ expect(callStart).toBeGreaterThan(-1);+ const callEnd = createView.indexOf("});", callStart);+ const call = createView.slice(callStart, callEnd);++ // Turning off the quote toggle must reach qualifiedTableName; otherwise it+ // unconditionally quotes the schema/view name regardless of the setting.+ expect(call).toContain("quoteIdentifiers: settingsStore.editorSettings.generateSqlQuoteIdentifiers");+ expect(call).toContain("includeDatabaseName: settingsStore.editorSettings.generateSqlIncludeDatabaseName");+ });+});