-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontacts_delete_fn.sql
More file actions
63 lines (47 loc) · 1.39 KB
/
contacts_delete_fn.sql
File metadata and controls
63 lines (47 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
CREATE OR REPLACE FUNCTION ndb.contacts_delete_fn()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
update ndb.chronologies
set contactid = null
where contactid = OLD.contactid;
delete from ndb.collectors
where contactid = OLD.contactid;
update ndb.constituentdatabases
set contactid = null
where contactid = OLD.contactid ;
delete from ndb.dataprocessors
where contactid = OLD.contactid;
delete from ndb.datasetpis
where contactid = OLD.contactid;
update ndb.datasetsubmissions
set contactid = null
where contactid = OLD.contactid;
delete from ndb.datasettaxonnotes
where contactid = OLD.contactid;
delete from ndb.datataxonnotes
where contactid = OLD.contactid;
update ndb.isometadata
set analystid = null
where analystid = OLD.contactid;
delete from ndb.publicationauthors
where contactid = OLD.contactid;
delete from ndb.sampleanalysts
where contactid = OLD.contactid;
update ndb.siteimages
set contactid = null
where contactid = OLD.contactid;
delete from ti.stewards
where contactid = OLD.contactid;
delete from ti.stewardupdates
where contactid = OLD.contactid;
update ndb.synonymy
set contactid = null
where contactid = OLD.contactid;
update ndb.taxa
set validatorid = null
where validatorid = OLD.contactid;
RETURN NULL;
END;
$function$