Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5c49e28b

Von Sven Schöling vor etwa 12 Jahren hinzugefügt

  • ID 5c49e28ba1e7b146d94bb66bf8fa7a4a5a591a49
  • Vorgänger cc8edd18
  • Nachfolger 8486efb7

Syntaxkorrektur zu den record_links triggern

Unterschiede anzeigen:

sql/Pg-upgrade2/record_links_post_delete_triggers2.sql
1
-- @tag: record_links_post_delete_triggers2
2
-- @description: PL/PgSQL Syntax Fix
3
-- @depends: record_links_post_delete_triggers
4
-- @encoding: utf8
5

  
6
CREATE OR REPLACE FUNCTION clean_up_record_links_before_oe_delete() RETURNS trigger AS $$
7
  BEGIN
8
    DELETE FROM record_links
9
      WHERE (from_table = 'oe' AND from_id = OLD.id)
10
         OR (to_table   = 'oe' AND to_id   = OLD.id);
11
    RETURN OLD;
12
  END;
13
$$ LANGUAGE plpgsql;
14

  
15
CREATE OR REPLACE FUNCTION clean_up_record_links_before_delivery_orders_delete() RETURNS trigger AS $$
16
  BEGIN
17
    DELETE FROM record_links
18
      WHERE (from_table = 'delivery_orders' AND from_id = OLD.id)
19
         OR (to_table   = 'delivery_orders' AND to_id   = OLD.id);
20
    RETURN OLD;
21
  END;
22
$$ LANGUAGE plpgsql;
23

  
24
CREATE OR REPLACE FUNCTION clean_up_record_links_before_ar_delete() RETURNS trigger AS $$
25
  BEGIN
26
    DELETE FROM record_links
27
      WHERE (from_table = 'ar' AND from_id = OLD.id)
28
         OR (to_table   = 'ar' AND to_id   = OLD.id);
29
    RETURN OLD;
30
  END;
31
$$ LANGUAGE plpgsql;
32

  
33
CREATE OR REPLACE FUNCTION clean_up_record_links_before_ap_delete() RETURNS trigger AS $$
34
  BEGIN
35
    DELETE FROM record_links
36
      WHERE (from_table = 'ap' AND from_id = OLD.id)
37
         OR (to_table   = 'ap' AND to_id   = OLD.id);
38
    RETURN OLD;
39
  END;
40
$$ LANGUAGE plpgsql;

Auch abrufbar als: Unified diff