From: | Knut Suebert <knut(dot)suebert(at)web(dot)de> |
---|---|
To: | Joe Conway <joseph(dot)conway(at)home(dot)com> |
Subject: | Re: trigger: NEW/OLD-error or nothing happens |
Date: | 2001-07-08 15:08:36 |
Message-ID: | 20010708170836.B17727@cascal.vtb |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Joe Conway schrieb:
> OLD does not make sense on an insert because there is no "OLD" data for a
> brand new row. Similarly, there is no "NEW" data during a delete. See
> http://www.postgresql.org/idocs/index.php?plpgsql-trigger.html
Makes sense, thanks. And at the bottom of that page is a nice hint
regarding the trigger BEFORE/AFTER insert.
So I changed to BEFORE -- but still nothing happens
An exception for debugging:
create function nac_viceversa() returns opaque as'
declare
x int4;
begin
x := nacmin(NEW.sport,NEW.dport)
NEW.minport := x;
NEW.maxport := nacmax(NEW.sport,NEW.dport);
raise exception ''%'',x;
return NEW;
end;
'language 'plpgsql';
create trigger nac_update before insert or update on traf
for each row execute procedure nac_viceversa();
the calculation works...
ERROR: 110
ERROR: 110
ERROR: 110
... but is not written into the row -- even after removing the exception ;-)
id | ... | device | minport | maxport
12151 | ... | eth0 | |
12152 | ... | eth0 | |
Am I stupid?
Knut Sübert
From | Date | Subject | |
---|---|---|---|
Next Message | omid omoomi | 2001-07-08 15:42:13 | Re: Re: index on a box |
Previous Message | ÀîÁ¢Ð | 2001-07-08 13:02:32 | Re: Re: index on a box |