File tree Expand file tree Collapse file tree
pgpm/constructive-compute
deploy/schemas/constructive_compute_public/procedures/platform_create_function_graph Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,14 +17,22 @@ DECLARE
1717 v_store_id uuid;
1818 v_graph_id uuid;
1919BEGIN
20- INSERT INTO " constructive_platform_function_graph_public" .platform_function_graph_store (
21- database_id,
22- name
23- )
24- VALUES
25- (platform_create_function_graph .database_id , platform_create_function_graph .name )
26- RETURNING id INTO v_store_id;
27- PERFORM " constructive_platform_function_graph_public" .init_empty_repo(platform_create_function_graph .database_id , v_store_id);
20+ SELECT id
21+ FROM " constructive_platform_function_graph_public" .platform_function_graph_store
22+ WHERE
23+ database_id = platform_create_function_graph .database_id
24+ AND name = platform_create_function_graph .name
25+ INTO v_store_id;
26+ IF v_store_id IS NULL THEN
27+ INSERT INTO " constructive_platform_function_graph_public" .platform_function_graph_store (
28+ database_id,
29+ name
30+ )
31+ VALUES
32+ (platform_create_function_graph .database_id , platform_create_function_graph .name )
33+ RETURNING id INTO v_store_id;
34+ PERFORM " constructive_platform_function_graph_public" .init_empty_repo(platform_create_function_graph .database_id , v_store_id);
35+ END IF;
2836 INSERT INTO " constructive_compute_public" .platform_function_graphs (
2937 database_id,
3038 store_id,
Original file line number Diff line number Diff line change @@ -842,14 +842,22 @@ DECLARE
842842 v_store_id uuid;
843843 v_graph_id uuid;
844844BEGIN
845- INSERT INTO " constructive_platform_function_graph_public" .platform_function_graph_store (
846- database_id,
847- name
848- )
849- VALUES
850- (platform_create_function_graph .database_id , platform_create_function_graph .name )
851- RETURNING id INTO v_store_id;
852- PERFORM " constructive_platform_function_graph_public" .init_empty_repo(platform_create_function_graph .database_id , v_store_id);
845+ SELECT id
846+ FROM " constructive_platform_function_graph_public" .platform_function_graph_store
847+ WHERE
848+ database_id = platform_create_function_graph .database_id
849+ AND name = platform_create_function_graph .name
850+ INTO v_store_id;
851+ IF v_store_id IS NULL THEN
852+ INSERT INTO " constructive_platform_function_graph_public" .platform_function_graph_store (
853+ database_id,
854+ name
855+ )
856+ VALUES
857+ (platform_create_function_graph .database_id , platform_create_function_graph .name )
858+ RETURNING id INTO v_store_id;
859+ PERFORM " constructive_platform_function_graph_public" .init_empty_repo(platform_create_function_graph .database_id , v_store_id);
860+ END IF;
853861 INSERT INTO " constructive_compute_public" .platform_function_graphs (
854862 database_id,
855863 store_id,
You can’t perform that action at this time.
0 commit comments