Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

feat(sidebar): list package bodies as their own object group

弈秋763aeda38ac6
diff --git a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
index 32bd68b888..6d7798e69e 100644
--- a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
+++ b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue
@@ -866,6 +866,7 @@ const groupTypes: Set<TreeNodeType> = new Set([
"group-synonyms",
"group-jobs",
"group-packages",
+ "group-package-bodies",
"group-types",
"group-partitions",
"group-extensions",
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index 93fe458d32..8cfddec3ff 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -436,6 +436,8 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
return { icon: Clock, colorClass: "text-orange-400" };
case "group-packages":
return { icon: Package, colorClass: "text-cyan-500" };
+ case "group-package-bodies":
+ return { icon: Package, colorClass: "text-cyan-500" };
case "group-types":
return { icon: Braces, colorClass: "text-violet-500" };
case "group-database-indexes":
@@ -1734,6 +1736,7 @@ function onKeydown(event: KeyboardEvent) {
node.type === 'group-synonyms' ||
node.type === 'group-jobs' ||
node.type === 'group-packages' ||
+ node.type === 'group-package-bodies' ||
node.type === 'group-types' ||
node.type === 'group-partitions' ||
node.type === 'type-attributes' ||
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index e0ef92dabb..af989843d9 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -4177,6 +4177,7 @@ export default withEnglishFallback({
schedulerJobs: "Planlaşdırılmış tapşırıqlar",
synonyms: "Sinonimlər",
packages: "Paketlər",
+ packageBodies: "Paket gövdələri",
types: "Növlər",
gridfs: "GridFS",
partitions: "Bölmələr",
@@ -4676,6 +4677,7 @@ export default withEnglishFallback({
functions: "Funksiyalar",
sequences: "Ardıcıllıqlar",
packages: "Paketlər",
+ packageBodies: "Paket gövdələri",
table: "Cədvəl",
collection: "Kolleksiya",
partitions: "{count} bölmə",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index c81ecbe0c8..fcd6fc5bbc 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -5288,6 +5288,7 @@ export default {
databaseLinks: "Database Links",
synonyms: "Synonyms",
packages: "Packages",
+ packageBodies: "Package bodies",
types: "Types",
gridfs: "GridFS",
partitions: "Partitions",
@@ -6479,6 +6480,7 @@ export default {
functions: "Functions",
sequences: "Sequences",
packages: "Packages",
+ packageBodies: "Package bodies",
table: "Table",
collection: "Collection",
partitions: "{count} partitions",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index d92c39105e..6e3e4d4e3d 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -5044,6 +5044,7 @@ export default withEnglishFallback({
schedulerJobs: "Trabajos programados",
synonyms: "Sinónimos",
packages: "Paquetes",
+ packageBodies: "Cuerpos de paquete",
partitions: "Particiones",
subpartitions: "Subparticiones",
childTables: "Subtablas",
@@ -5560,6 +5561,7 @@ export default withEnglishFallback({
functions: "Funciones",
sequences: "Secuencias",
packages: "Paquetes",
+ packageBodies: "Cuerpos de paquete",
table: "Tabla",
collection: "Colección",
partitions: "{count} particiones",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index 1fc5f3e07e..f9929915ad 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -4529,6 +4529,7 @@ export default withEnglishFallback({
databaseLinks: "Link Database",
synonyms: "Sinonim",
packages: "Paket",
+ packageBodies: "Isi paket",
types: "Tipe",
gridfs: "GridFS",
partitions: "Partisi",
@@ -5283,6 +5284,7 @@ export default withEnglishFallback({
functions: "Fungsi",
sequences: "Sekuens",
packages: "Paket",
+ packageBodies: "Isi paket",
table: "Tabel",
collection: "Koleksi",
partitions: "{count} partisi",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 26312e956b..27d6641866 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -4864,6 +4864,7 @@ export default withEnglishFallback({
schedulerJobs: "Lavori pianificati",
synonyms: "Sinonimi",
packages: "Pacchetti",
+ packageBodies: "Corpi dei package",
partitions: "Partizioni",
subpartitions: "Sottopartizioni",
childTables: "Sottotabelle",
@@ -5380,6 +5381,7 @@ export default withEnglishFallback({
functions: "Funzioni",
sequences: "Sequenze",
packages: "Pacchetti",
+ packageBodies: "Corpi dei package",
table: "Tabella",
collection: "Collezione",
partitions: "{count} partizioni",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 8c446f854b..2a3cfd4866 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -4885,6 +4885,7 @@ export default withEnglishFallback({
schedulerJobs: "スケジュール済みジョブ",
synonyms: "シノニム",
packages: "パッケージ",
+ packageBodies: "パッケージ本体",
partitions: "パーティション",
subpartitions: "サブパーティション",
childTables: "子テーブル",
@@ -5434,6 +5435,7 @@ export default withEnglishFallback({
functions: "関数",
sequences: "シーケンス",
packages: "パッケージ",
+ packageBodies: "パッケージ本体",
table: "テーブル",
collection: "コレクション",
partitions: "{count}パーティション",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 21bfc0d90a..80d450aef2 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -4799,6 +4799,7 @@ export default withEnglishFallback({
schedulerJobs: "예약된 작업",
synonyms: "동의어",
packages: "패키지",
+ packageBodies: "패키지 본문",
types: "타입",
gridfs: "GridFS",
partitions: "파티션",
@@ -5664,6 +5665,7 @@ export default withEnglishFallback({
functions: "함수",
sequences: "시퀀스",
packages: "패키지",
+ packageBodies: "패키지 본문",
table: "테이블",
collection: "컬렉션",
partitions: "파티션 {count}개",
diff --git a/apps/desktop/src/i18n/locales/pl.ts b/apps/desktop/src/i18n/locales/pl.ts
index 925a136451..3e4eadd1a1 100644
--- a/apps/desktop/src/i18n/locales/pl.ts
+++ b/apps/desktop/src/i18n/locales/pl.ts
@@ -4599,6 +4599,7 @@ export default withEnglishFallback({
databaseLinks: "Łącza bazodanowe",
synonyms: "Synonimy",
packages: "Pakiety",
+ packageBodies: "Ciała pakietów",
types: "Typy",
gridfs: "GridFS",
partitions: "Partycje",
@@ -5324,6 +5325,7 @@ export default withEnglishFallback({
functions: "Funkcje",
sequences: "Sekwencje",
packages: "Pakiety",
+ packageBodies: "Ciała pakietów",
table: "Tabela",
collection: "Kolekcja",
partitions: "Partycje: {count}",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index aa50a6840e..16c4219e6a 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -4864,6 +4864,7 @@ export default withEnglishFallback({
schedulerJobs: "Trabalhos agendados",
synonyms: "Sinônimos",
packages: "Pacotes",
+ packageBodies: "Corpos de pacote",
partitions: "Partições",
subpartitions: "Subpartições",
childTables: "Subtabelas",
@@ -5380,6 +5381,7 @@ export default withEnglishFallback({
functions: "Funções",
sequences: "Sequências",
packages: "Pacotes",
+ packageBodies: "Corpos de pacote",
table: "Tabela",
collection: "Coleção",
partitions: "{count} partições",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index bea15821df..747d00d094 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -4985,6 +4985,7 @@ export default withEnglishFallback({
databaseLinks: "Ссылки на базы данных",
synonyms: "Синонимы",
packages: "Пакеты",
+ packageBodies: "Тела пакетов",
types: "Типы",
gridfs: "GridFS",
partitions: "Секции",
@@ -6134,6 +6135,7 @@ export default withEnglishFallback({
functions: "Функции",
sequences: "Последовательности",
packages: "Пакеты",
+ packageBodies: "Тела пакетов",
table: "Таблица",
collection: "Коллекция",
partitions: "Разделов: {count}",
diff --git a/apps/desktop/src/i18n/locales/th.ts b/apps/desktop/src/i18n/locales/th.ts
index 63a3ec44ce..a6992d74c0 100644
--- a/apps/desktop/src/i18n/locales/th.ts
+++ b/apps/desktop/src/i18n/locales/th.ts
@@ -5171,6 +5171,7 @@ export default withEnglishFallback({
databaseLinks: "Database Links",
synonyms: "Synonyms",
packages: "Packages",
+ packageBodies: "เนื้อหาแพ็กเกจ",
types: "Types",
gridfs: "GridFS",
partitions: "Partitions",
@@ -6411,6 +6412,7 @@ export default withEnglishFallback({
functions: "Functions",
sequences: "Sequences",
packages: "Packages",
+ packageBodies: "เนื้อหาแพ็กเกจ",
table: "ตาราง",
collection: "Collection",
partitions: "Partitions {count} รายการ",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index 7b77eb7971..7989a3dbe2 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -4146,6 +4146,7 @@ export default withEnglishFallback({
schedulerJobs: "Zamanlanmış İşler",
synonyms: "Eş Adlar",
packages: "Paketler",
+ packageBodies: "Paket gövdeleri",
types: "Türler",
gridfs: "GridFS",
partitions: "Bölümler",
@@ -4577,6 +4578,7 @@ export default withEnglishFallback({
functions: "İşlevler",
sequences: "Diziler (Sequence)",
packages: "Paketler",
+ packageBodies: "Paket gövdeleri",
table: "Tablo",
collection: "Koleksiyon",
partitions: "{count} bölüm",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index af7871ff74..4207c9ea90 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -5215,6 +5215,7 @@ export default withEnglishFallback({
databaseLinks: "数据库链接",
synonyms: "同义词",
packages: "包",
+ packageBodies: "包体",
types: "类型",
gridfs: "GridFS",
partitions: "分区",
@@ -6454,6 +6455,7 @@ export default withEnglishFallback({
functions: "函数",
sequences: "序列",
packages: "包",
+ packageBodies: "包体",
table: "表",
collection: "集合",
partitions: "{count} 个分区",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 994396fdb6..44befcae3e 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -4864,6 +4864,7 @@ export default withEnglishFallback({
schedulerJobs: "排程工作",
synonyms: "同義詞",
packages: "套件",
+ packageBodies: "套裝程式主體",
partitions: "分割區",
subpartitions: "子分割區",
childTables: "子表",
@@ -4924,6 +4925,7 @@ export default withEnglishFallback({
functions: "函式",
sequences: "序列",
packages: "套件",
+ packageBodies: "套裝程式主體",
table: "資料表",
collection: "集合",
partitions: "{count} 個分割區",
diff --git a/apps/desktop/src/lib/__tests__/database/databaseObjectCapabilities.spec.ts b/apps/desktop/src/lib/__tests__/database/databaseObjectCapabilities.spec.ts
index c6041e9b98..edf1200ad4 100644
--- a/apps/desktop/src/lib/__tests__/database/databaseObjectCapabilities.spec.ts
+++ b/apps/desktop/src/lib/__tests__/database/databaseObjectCapabilities.spec.ts
@@ -60,7 +60,7 @@ describe("databaseObjectCapabilities", () => {
schema: "APP",
objectTypes: oceanBaseObjects,
}).map((node) => node.type),
- ).toEqual(["group-tables", "group-views", "group-materialized-views", "group-procedures", "group-functions", "group-triggers", "group-sequences", "group-database-indexes", "group-synonyms", "group-packages", "group-types"]);
+ ).toEqual(["group-tables", "group-views", "group-materialized-views", "group-procedures", "group-functions", "group-triggers", "group-sequences", "group-database-indexes", "group-synonyms", "group-packages", "group-package-bodies", "group-types"]);
});
it("exposes Oracle sequences through the existing grouped object path", () => {
diff --git a/apps/desktop/src/lib/__tests__/table/tableTree.spec.ts b/apps/desktop/src/lib/__tests__/table/tableTree.spec.ts
index c778056e1d..5169419dac 100644
--- a/apps/desktop/src/lib/__tests__/table/tableTree.spec.ts
+++ b/apps/desktop/src/lib/__tests__/table/tableTree.spec.ts
@@ -750,3 +750,36 @@ describe("tablePageRowAnchorKey", () => {
expect(tablePageRowAnchorKey("p_2024", "app")).not.toBe(tablePageRowAnchorKey("p_2024", "app", "orders"));
});
});
+
+describe("package and package body groups (#13239)", () => {
+ function pkg(type: string, name: string): ObjectInfo {
+ return { name, object_type: type, schema: "app" } as ObjectInfo;
+ }
+
+ it("splits packages and package bodies into separate groups", () => {
+ const nodes = buildGroupedObjectTreeNodes({
+ ...context,
+ objects: [pkg("PACKAGE", "ledger"), pkg("PACKAGE_BODY", "ledger"), pkg("PACKAGE", "reports")],
+ databaseType: "oracle",
+ });
+ const packagesGroup = nodes.find((node) => node.type === "group-packages");
+ const bodiesGroup = nodes.find((node) => node.type === "group-package-bodies");
+ expect(bodiesGroup).toBeDefined();
+ const packageChildren = packagesGroup!.children!.map((node) => node.label);
+ expect(packageChildren).toEqual(["ledger", "reports"]);
+ expect(bodiesGroup!.children!.map((node) => node.label)).toEqual(["ledger"]);
+ });
+
+ it("keeps the body-only package visible inside the bodies group", () => {
+ const nodes = buildGroupedObjectTreeNodes({
+ ...context,
+ objects: [pkg("PACKAGE_BODY", "orphan")],
+ databaseType: "oracle",
+ });
+ const bodiesGroup = nodes.find((node) => node.type === "group-package-bodies");
+ expect(bodiesGroup!.children!.map((node) => node.label)).toEqual(["orphan"]);
+ // Empty groups may be omitted entirely rather than rendered with zero children.
+ const packagesGroup = nodes.find((node) => node.type === "group-packages");
+ expect(!packagesGroup || (packagesGroup.children ?? []).length === 0).toBe(true);
+ });
+});
diff --git a/apps/desktop/src/lib/sidebar/sidebarGlobalSearchIndex.ts b/apps/desktop/src/lib/sidebar/sidebarGlobalSearchIndex.ts
index fbaf0e29f9..7fbb9d1a98 100644
--- a/apps/desktop/src/lib/sidebar/sidebarGlobalSearchIndex.ts
+++ b/apps/desktop/src/lib/sidebar/sidebarGlobalSearchIndex.ts
@@ -2,6 +2,9 @@ import type { TableInfo, TreeNode, TreeNodeType } from "@/types/database";
import { nodeMatchesRegexScopeIdentity, type SidebarRegexIndexScope } from "@/lib/sidebar/sidebarSearchTree";
import { isSidebarSearchPrunedDatabaseNode } from "@/lib/sidebar/sidebarSearchDatabaseScope";
+// Only table-ish groups: the indexed builder emits table/view/materialized_view
+// rows, so indexing package bodies would turn them into tables (wrong icon, table
+// structure on open). Bodies are covered by remote object-group search instead.
export const sidebarIndexedObjectGroupTypes = new Set<TreeNodeType>(["group-tables", "group-dolt-system-tables", "group-views", "group-materialized-views"]);
const containerTypes = new Set<TreeNodeType>(["database", "schema", "linked-server-schema", "doris-catalog"]);
const linkedContainerTypes = new Set<TreeNodeType>(["linked-server-root", "linked-server", "linked-server-catalog"]);
diff --git a/apps/desktop/src/lib/sidebar/treeNodeClick.ts b/apps/desktop/src/lib/sidebar/treeNodeClick.ts
index c8ab9f196b..0383560e9a 100644
--- a/apps/desktop/src/lib/sidebar/treeNodeClick.ts
+++ b/apps/desktop/src/lib/sidebar/treeNodeClick.ts
@@ -102,6 +102,7 @@ const databaseChildGroupNodeTypes = new Set<TreeNodeType>([
"group-synonyms",
"group-jobs",
"group-packages",
+ "group-package-bodies",
"group-types",
]);
const displayPathObjectNodeTypes = new Set<TreeNodeType>(["table", "view", "materialized_view", "procedure", "function", "trigger", "event", "sequence", "synonym", "package", "package-body", "type", "type-body"]);
diff --git a/apps/desktop/src/lib/sidebar/treeNodeGroup.ts b/apps/desktop/src/lib/sidebar/treeNodeGroup.ts
index 464f63c8da..714f89ca79 100644
--- a/apps/desktop/src/lib/sidebar/treeNodeGroup.ts
+++ b/apps/desktop/src/lib/sidebar/treeNodeGroup.ts
@@ -21,6 +21,7 @@ const treeGroupNodeTypes = new Set<TreeNodeType>([
"group-synonyms",
"group-jobs",
"group-packages",
+ "group-package-bodies",
"group-types",
"group-partitions",
"group-extensions",
diff --git a/apps/desktop/src/lib/sidebar/treeNodeIcon.ts b/apps/desktop/src/lib/sidebar/treeNodeIcon.ts
index 862bd5b1c6..70b1b15afc 100644
--- a/apps/desktop/src/lib/sidebar/treeNodeIcon.ts
+++ b/apps/desktop/src/lib/sidebar/treeNodeIcon.ts
@@ -149,6 +149,8 @@ export function getTreeNodeIconInfo(node: TreeNode): TreeNodeIconInfo | null {
return { icon: Clock, colorClass: "text-orange-400" };
case "group-packages":
return { icon: Package, colorClass: "text-cyan-500" };
+ case "group-package-bodies":
+ return { icon: Package, colorClass: "text-cyan-500" };
case "group-tablespaces":
return { icon: Database, colorClass: "text-orange-500" };
case "group-datafiles":
diff --git a/apps/desktop/src/lib/table/tableTree.ts b/apps/desktop/src/lib/table/tableTree.ts
index 5acfc119c9..8da8c37db0 100644
--- a/apps/desktop/src/lib/table/tableTree.ts
+++ b/apps/desktop/src/lib/table/tableTree.ts
@@ -900,9 +900,18 @@ const groupDefs: Array<{
{
key: "__packages",
label: "tree.packages",
- objectTypes: ["PACKAGE", "PACKAGE_BODY"],
+ objectTypes: ["PACKAGE"],
nodeType: "group-packages",
- childType: (objectType) => (objectType === "PACKAGE_BODY" ? "package-body" : "package"),
+ childType: "package",
+ },
+ {
+ // #13239: package bodies live in their own group (PL/SQL Developer style)
+ // so browsing/editing the body no longer risks picking the spec.
+ key: "__package_bodies",
+ label: "tree.packageBodies",
+ objectTypes: ["PACKAGE_BODY"],
+ nodeType: "group-package-bodies",
+ childType: "package-body",
},
{
key: "__types",
@@ -929,6 +938,7 @@ const objectGroupNodeTypes = new Set<TreeNodeType>([
"group-synonyms",
"group-jobs",
"group-packages",
+ "group-package-bodies",
"group-types",
]);
@@ -974,8 +984,16 @@ export function objectGroupRefreshParentId(node: TreeNode): string | null {
return node.id.slice(0, suffixStart);
}
-export function objectTypesForGroupNode(type: TreeNodeType): DatabaseObjectTreeKind[] | null {
- return groupDefs.find((def) => def.nodeType === type)?.objectTypes ?? null;
+/**
+ * #13239: Xugu folds a package body into its package spec node, so the packages
+ * group must still fetch and keep PACKAGE_BODY rows — a body that only arrives
+ * on a later page then collapses into the spec child through
+ * `coalesceXuguPackageObjects`. Other drivers keep bodies in their own
+ * `__package_bodies` group.
+ */
+export function objectTypesForGroupNode(type: TreeNodeType, databaseType?: DatabaseType): DatabaseObjectTreeKind[] | null {
+ const objectTypes = groupDefs.find((def) => def.nodeType === type)?.objectTypes ?? null;
+ return objectTypes && type === "group-packages" && databaseType === "xugu" ? ["PACKAGE", "PACKAGE_BODY"] : objectTypes;
}
export function buildGroupedObjectTreeNodes({
diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts
index 1eb47fb276..de5073536b 100644
--- a/apps/desktop/src/stores/connectionStore.ts
+++ b/apps/desktop/src/stores/connectionStore.ts
@@ -3160,7 +3160,7 @@ export const useConnectionStore = defineStore("connection", () => {
const connectionId = node.connectionId;
if (!query.trim() || !connectionId || node.database == null || !connectedIds.value.has(connectionId) || signal.aborted) return [];
const config = getConfig(connectionId);
- const groupTypes = objectTypesForGroupNode(node.type);
+ const groupTypes = objectTypesForGroupNode(node.type, effectiveDatabaseTypeForConnection(config));
const objectTypes = (groupTypes ?? sidebarObjectTypesForScope(config, node.database, node.schema)).filter((type) => type !== "TABLE" && type !== "VIEW" && type !== "MATERIALIZED_VIEW");
if (!objectTypes.length) return [];
const querySchema = connectionObjectTreeQuerySchema(config, node.database, node.schema);
@@ -7366,7 +7366,7 @@ export const useConnectionStore = defineStore("connection", () => {
}
const configForScope = node.connectionId ? getConfig(node.connectionId) : undefined;
- const objectTypesForScope = objectTypesForGroupNode(node.type);
+ const objectTypesForScope = objectTypesForGroupNode(node.type, effectiveDatabaseTypeForConnection(configForScope));
const pageSizeForScope = sidebarObjectGroupPageSize();
const searchFilter = activeTreeLoadSearchFilter(options);
const querySchemaForScope = connectionObjectTreeQuerySchema(configForScope, node.database || "", node.schema);
@@ -7410,7 +7410,7 @@ export const useConnectionStore = defineStore("connection", () => {
forgetFilteredObjectGroupChildren(node.id);
return;
}
- const objectTypes = objectTypesForGroupNode(node.type);
+ const objectTypes = objectTypesForGroupNode(node.type, effectiveDatabaseTypeForConnection(getConfig(node.connectionId)));
const parentNodeId = objectGroupRefreshParentId(node);
if (!objectTypes || !parentNodeId) return;
@@ -7596,7 +7596,7 @@ export const useConnectionStore = defineStore("connection", () => {
if (!parent?.connectionId || !hasTreeNodeDatabaseContext(parent)) return;
const parentConnectionId = parent.connectionId;
const configForScope = getConfig(parentConnectionId);
- const objectTypesForScope = loadMore.objectType === "INDEX" ? (["INDEX"] as DatabaseObjectTreeKind[]) : objectTypesForGroupNode(parent.type);
+ const objectTypesForScope = loadMore.objectType === "INDEX" ? (["INDEX"] as DatabaseObjectTreeKind[]) : objectTypesForGroupNode(parent.type, effectiveDatabaseTypeForConnection(configForScope));
const searchFilter = loadMore.searchFilter ?? options?.searchFilter;
const globalSearchQuery = sidebarSearchQuery.value || "";
const scopedSearchQuery = sidebarTableSearchQueries.value[parent.id]?.trim() || "";
@@ -7684,7 +7684,7 @@ export const useConnectionStore = defineStore("connection", () => {
if (currentTargetParent && parentEpoch.isCurrent()) currentTargetParent.isExpanded = true;
return;
}
- const objectTypes = objectTypesForGroupNode(parent.type);
+ const objectTypes = objectTypesForGroupNode(parent.type, effectiveDatabaseTypeForConnection(getConfig(parentConnectionId)));
const parentNodeId = objectGroupRefreshParentId(parent);
if (!objectTypes || !parentNodeId) return;
diff --git a/packages/app-tests/tableTree.test.ts b/packages/app-tests/tableTree.test.ts
index 58e2d122c0..44fae9eede 100644
--- a/packages/app-tests/tableTree.test.ts
+++ b/packages/app-tests/tableTree.test.ts
@@ -139,10 +139,7 @@ test("mergeTableTreePageChildren dedupes non-table nodes repeated across pages",
const ids = merged.map((node) => node.id);
assert.equal(new Set(ids).size, ids.length, "merged children must not contain duplicate ids");
assert.equal(merged.filter((node) => node.type === "view").length, 1, "the repeated view must appear once");
- assert.deepEqual(
- merged.map((node) => node.label).sort(),
- ["orders", "orders_v", "payments"].sort(),
- );
+ assert.deepEqual(merged.map((node) => node.label).sort(), ["orders", "orders_v", "payments"].sort());
});
test("buildTableTreeNodes keeps sidebar tables in natural name order", () => {
@@ -228,10 +225,15 @@ test("buildGroupedObjectTreeNodes groups Oracle packages and package bodies", ()
assert.equal(packageGroup?.label, "tree.packages");
assert.deepEqual(
packageGroup?.children?.map((node) => ({ label: node.label, type: node.type, id: node.id })),
- [
- { label: "PAYROLL", type: "package", id: "conn:app:HR:__packages:HR:PAYROLL:PACKAGE" },
- { label: "PAYROLL", type: "package-body", id: "conn:app:HR:__packages:HR:PAYROLL:PACKAGE_BODY" },
- ],
+ [{ label: "PAYROLL", type: "package", id: "conn:app:HR:__packages:HR:PAYROLL:PACKAGE" }],
+ );
+
+ // #13239: the body lives in its own group so picking it cannot open the spec.
+ const bodyGroup = groups.find((node) => node.type === "group-package-bodies");
+ assert.equal(bodyGroup?.label, "tree.packageBodies");
+ assert.deepEqual(
+ bodyGroup?.children?.map((node) => ({ label: node.label, type: node.type, id: node.id })),
+ [{ label: "PAYROLL", type: "package-body", id: "conn:app:HR:__package_bodies:HR:PAYROLL:PACKAGE_BODY" }],
);
});