On Friday 05 March 2004 14:00, beer wrote:
> Hello All
>
> I'm running 7.3.4-1 on a RH9 box. I'm having a problem with a trigger
> that seems to execute without actually performing the update that it
> should. The update returns true everytime however if it is the first time
> that the trigger executes on a given row, the column is not updated. The
> column is updated correctly on subsequent calls.
Perhaps put some debug code in and insert into tabB manually
> CREATE OR REPLACE FUNCTION "tabB_postinsert" () RETURNS TRIGGER AS '
> --
> -- Actions to take after inserting into tabB
> --
DECLARE
numrows int4;
> BEGIN
> -- Increment tabA.attachments
> UPDATE tabA SET Acol3 = Acol3 + 1 WHERE id = NEW.tabA_id;
GET DIAGNOSTICTS numrows = ROW_COUNT;
RAISE NOTICE ''Updated % rows with id = %'',numrows, NEW.tabA_id;
> -- done
> RETURN NEW;
> END; ' LANGUAGE 'plpgsql';
Insert into tabB from psql and you should see a NOTICE message telling you
what is happening.
--
Richard Huxton
Archonet Ltd