diff options
Diffstat (limited to 'sql/func.sql')
-rw-r--r-- | sql/func.sql | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/sql/func.sql b/sql/func.sql index 977b775a..53798285 100644 --- a/sql/func.sql +++ b/sql/func.sql @@ -399,46 +399,6 @@ DECLARE BEGIN SELECT id INTO xoldchid FROM changes WHERE type = xtype AND itemid = xedit.itemid AND rev = xedit.rev-1; - -- Set producers.rgraph to NULL and notify when: - -- 1. There's a new producer entry with some relations - -- 2. The producer name/type/language has changed - -- 3. The producer relations have been changed - IF xtype = 'p' THEN - IF -- 1. - (xoldchid IS NULL AND EXISTS(SELECT 1 FROM producers_relations_hist WHERE chid = xedit.chid)) - OR (xoldchid IS NOT NULL AND ( - -- 2. - EXISTS(SELECT 1 FROM producers_hist p1, producers_hist p2 WHERE (p2.name <> p1.name OR p2.type <> p1.type OR p2.lang <> p1.lang) AND p1.chid = xoldchid AND p2.chid = xedit.chid) - -- 3. - OR EXISTS(SELECT pid, relation FROM producers_relations_hist WHERE chid = xoldchid EXCEPT SELECT pid, relation FROM producers_relations_hist WHERE chid = xedit.chid) - OR EXISTS(SELECT pid, relation FROM producers_relations_hist WHERE chid = xedit.chid EXCEPT SELECT pid, relation FROM producers_relations_hist WHERE chid = xoldchid) - )) - THEN - UPDATE producers SET rgraph = NULL WHERE id = xedit.itemid; - NOTIFY relgraph; -- This notify is not done by the producer_relgraph_notify trigger for new entries or if rgraph was already NULL - END IF; - END IF; - - -- Set vn.rgraph to NULL and notify when: - -- 1. There's a new vn entry with some relations - -- 2. The vn title has changed - -- 3. The vn relations have been changed - IF xtype = 'v' THEN - IF -- 1. - (xoldchid IS NULL AND EXISTS(SELECT 1 FROM vn_relations_hist WHERE chid = xedit.chid)) - OR (xoldchid IS NOT NULL AND ( - -- 2. - EXISTS(SELECT 1 FROM vn_hist v1, vn_hist v2 WHERE v2.title <> v1.title AND v1.chid = xoldchid AND v2.chid = xedit.chid) - -- 3. - OR EXISTS(SELECT vid, relation, official FROM vn_relations_hist WHERE chid = xoldchid EXCEPT SELECT vid, relation, official FROM vn_relations_hist WHERE chid = xedit.chid) - OR EXISTS(SELECT vid, relation, official FROM vn_relations_hist WHERE chid = xedit.chid EXCEPT SELECT vid, relation, official FROM vn_relations_hist WHERE chid = xoldchid) - )) - THEN - UPDATE vn SET rgraph = NULL WHERE id = xedit.itemid; - NOTIFY relgraph; - END IF; - END IF; - -- Set c_search to NULL and notify when -- 1. A new VN entry is created -- 2. The vn title/original/alias has changed |