
Zitat von
pgmaddin
ok vielen dank...war nur um sicherzustellen, dass wir nich aneinander vorbeireden. Gibt es ein gutes Tutorial (neben der Hilfe) in wlechem das erstellen von Triggern mit pgAdmin beschrieben wird?
Inwieweit PGAdmin das verkompliziert, weiß ich nicht.
Code:
test=# create table tab1 (id int, val text);
CREATE TABLE
test=*# create table tab2 (id int, val text);
CREATE TABLE
test=*# create function f1() returns trigger as $$begin insert into tab2 (id) values (NEW.id); return NEW; end; $$language plpgsql;
CREATE FUNCTION
test=*# create trigger tg1 before insert on tab1 for each row execute procedure f1();
CREATE TRIGGER
test=*# insert into tab1 values (1, 'test');
INSERT 0 1
test=*# select * from tab2;
id | val
----+-----
1 |
(1 row)
test=*#
Andreas
Lesezeichen