fix(postgres): preserve overloaded routine signatures
This commit is contained in:
1 parent
4b2a6c971a
commit
727290fa32
6 files changed
+36
-11
No files matched your search
+19
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { appendTableTreeLoadMoreNode, buildSimpleObjectTreeNodes, buildTableTreeNodes, mergeTableTreePageChildren, tablePartitionGroups, withoutTableTreeLoadMoreNodes } from "@/lib/table/tableTree";
|
||||
import { appendTableTreeLoadMoreNode, buildGroupedObjectTreeNodes, buildSimpleObjectTreeNodes, buildTableTreeNodes, mergeTableTreePageChildren, tablePartitionGroups, withoutTableTreeLoadMoreNodes } from "@/lib/table/tableTree";
|
||||
import type { ObjectInfo, TableInfo, TreeNode } from "@/types/database";
|
||||
|
||||
const context = {
|
||||
@@ -27,6 +27,24 @@ describe("PostgreSQL overloaded routines", () => {
|
||||
);
|
||||
expect(new Set(nodes.map((node) => node.id)).size).toBe(3);
|
||||
});
|
||||
|
||||
it("keeps grouped routine nodes distinct by identity arguments", () => {
|
||||
const objects: ObjectInfo[] = [
|
||||
{ name: "calc", object_type: "FUNCTION", schema: "public", signature: "integer" },
|
||||
{ name: "calc", object_type: "FUNCTION", schema: "public", signature: "integer, integer" },
|
||||
{ name: "calc", object_type: "FUNCTION", schema: "public", signature: "numeric" },
|
||||
];
|
||||
|
||||
const groups = buildGroupedObjectTreeNodes({ ...context, schema: "public", objects });
|
||||
const functionGroup = groups.find((node) => node.type === "group-functions");
|
||||
|
||||
expect(functionGroup?.children?.map((node) => ({ label: node.label, objectName: node.objectName, signature: node.signature }))).toEqual([
|
||||
{ label: "calc(integer)", objectName: "calc", signature: "integer" },
|
||||
{ label: "calc(integer, integer)", objectName: "calc", signature: "integer, integer" },
|
||||
{ label: "calc(numeric)", objectName: "calc", signature: "numeric" },
|
||||
]);
|
||||
expect(new Set(functionGroup?.children?.map((node) => node.id) ?? []).size).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe("programmable database objects", () => {
|
||||
|
||||
Reference in new issue
Block a user