root/sql/sprocs/prism.add_graph_tags.sql

Revision a27cd9b462a686609eff744d1e6553da5605090b, 0.8 kB (checked in by Depesz Lubaczewski <depesz@omniti.com>, 5 years ago)

prism procedures, and simple tool to split pg_dump -n prism -s output into many files

  • Property mode set to 100644
Line 
1 CREATE OR REPLACE FUNCTION prism.add_graph_tags(in_graphid uuid, in_tags text) RETURNS void
2     AS $$
3   DECLARE
4    v_graphid uuid;
5    v_graph_tags text[];
6    new_tags_array text[];
7    BEGIN
8        SELECT graphid,graph_tags into v_graphid,v_graph_tags
9          FROM prism.saved_graphs
10            WHERE graphid =in_graphid;
11      IF NOT FOUND THEN
12                  RAISE EXCEPTION 'GraphID does not exist in saved graphs table.';
13             ELSE
14              new_tags_array:= array_append(v_graph_tags, in_tags);
15             UPDATE  prism.saved_graphs SET graph_tags = new_tags_array WHERE graphid=in_graphid;         
16       END IF;
17     RETURN;
18   END
19 $$
20     LANGUAGE plpgsql;
21
22
23 ALTER FUNCTION prism.add_graph_tags(in_graphid uuid, in_tags text) OWNER TO reconnoiter;
Note: See TracBrowser for help on using the browser.