Skip to content

A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

C++

fix(clickhouse): currentSchema defaults to connected DB, drop built-in functions from sidebar

DangHuynhbe33dc19ad56
diff --git a/windows/Gridex/ClickHouseAdapter.cpp b/windows/Gridex/ClickHouseAdapter.cpp
index 23f4150..919a49a 100644
--- a/windows/Gridex/ClickHouseAdapter.cpp
+++ b/windows/Gridex/ClickHouseAdapter.cpp
@@ -505,11 +505,14 @@ namespace DBModels
const std::wstring& /*schema*/)
{
ensureConnected();
- // Return built-in function names for auto-complete / documentation.
- // Scoped by origin='System' to avoid noise from user-defined functions.
+ // Only surface user-defined functions (origin='SQLUserDefined').
+ // ClickHouse ships ~1000 built-ins (BIT_AND, sumMap, etc.) — showing
+ // them as sidebar entries swamps the UI and some consumers were
+ // even treating them as tables. User-defined scope matches what
+ // PG / MySQL show.
auto result = executeInternal(
"SELECT name FROM system.functions "
- "WHERE origin = 'System' ORDER BY name");
+ "WHERE origin = 'SQLUserDefined' ORDER BY name");
std::vector<std::wstring> funcs;
for (auto& row : result.rows)
{
diff --git a/windows/Gridex/WorkspacePage.cpp b/windows/Gridex/WorkspacePage.cpp
index 47f875b..1247884 100644
--- a/windows/Gridex/WorkspacePage.cpp
+++ b/windows/Gridex/WorkspacePage.cpp
@@ -1322,6 +1322,18 @@ namespace winrt::Gridex::implementation
state_.statusSchema = config.database;
}
}
+ // ClickHouse: no schema concept, the connected database is the
+ // "schema". Without this branch currentSchema_ keeps the PG
+ // default "public" and listTables / fetchRows look for non-
+ // existent public.<table>.
+ else if (config.databaseType == DBModels::DatabaseType::ClickHouse)
+ {
+ if (!config.database.empty())
+ {
+ currentSchema_ = config.database;
+ state_.statusSchema = config.database;
+ }
+ }
UpdateBreadcrumb();