summaryrefslogtreecommitdiff
path: root/util/dump.sql
diff options
context:
space:
mode:
Diffstat (limited to 'util/dump.sql')
-rw-r--r--util/dump.sql60
1 files changed, 0 insertions, 60 deletions
diff --git a/util/dump.sql b/util/dump.sql
index cad84ac2..bf13c115 100644
--- a/util/dump.sql
+++ b/util/dump.sql
@@ -491,66 +491,6 @@ END;
$$ LANGUAGE plpgsql;
--- tag: tag to start with,
--- lvl: recursion level
--- dir: direction, true = parent->child, false = child->parent
-CREATE TYPE tag_tree_item AS (lvl smallint, tag integer, name text, c_vns integer);
-CREATE OR REPLACE FUNCTION tag_tree(tag integer, lvl integer, dir boolean) RETURNS SETOF tag_tree_item AS $$
-DECLARE
- r tag_tree_item%rowtype;
- r2 tag_tree_item%rowtype;
-BEGIN
- IF dir AND tag = 0 THEN
- FOR r IN
- SELECT lvl, t.id, t.name, t.c_vns
- FROM tags t
- WHERE state = 2 AND NOT EXISTS(SELECT 1 FROM tags_parents tp WHERE tp.tag = t.id)
- ORDER BY t.name
- LOOP
- RETURN NEXT r;
- IF lvl-1 <> 0 THEN
- FOR r2 IN SELECT * FROM tag_tree(r.tag, lvl-1, dir) LOOP
- RETURN NEXT r2;
- END LOOP;
- END IF;
- END LOOP;
- ELSIF dir THEN
- FOR r IN
- SELECT lvl, tp.tag, t.name, t.c_vns
- FROM tags_parents tp
- JOIN tags t ON t.id = tp.tag
- WHERE tp.parent = tag
- AND state = 2
- ORDER BY t.name
- LOOP
- RETURN NEXT r;
- IF lvl-1 <> 0 THEN
- FOR r2 IN SELECT * FROM tag_tree(r.tag, lvl-1, dir) LOOP
- RETURN NEXT r2;
- END LOOP;
- END IF;
- END LOOP;
- ELSE
- FOR r IN
- SELECT lvl, tp.parent, t.name, t.c_vns
- FROM tags_parents tp
- JOIN tags t ON t.id = tp.parent
- WHERE tp.tag = tag
- AND state = 2
- ORDER BY t.name
- LOOP
- RETURN NEXT r;
- IF lvl-1 <> 0 THEN
- FOR r2 IN SELECT * FROM tag_tree(r.tag, lvl-1, dir) LOOP
- RETURN NEXT r2;
- END LOOP;
- END IF;
- END LOOP;
- END IF;
-END;
-$$ LANGUAGE plpgsql;
-
-
-- recalculate tags_vn_inherit
CREATE OR REPLACE FUNCTION tag_vn_calc() RETURNS void AS $$
BEGIN