Basic Trigger - Mailing list pgsql-general

From Roberto de Amorim
Subject Basic Trigger
Date
Msg-id 006b01c28ef3$84fb3d10$04c8a8c0@Desenvolvimento
Whole thread Raw
Responses Re: Basic Trigger
Re: Basic Trigger
List pgsql-general
Hi all,

I did some Trigger to set default values for each row interted.
so, I'm using NEW.ID = NEXTVAL(''products_id_seq'');
but the column do not assum this value...
must I execute any other command before to set a value for NEW?

CREATE OR REPLACE FUNCTION "f_products"() RETURNS "opaque" AS '
BEGIN
   NEW.ID = NEXTVAL(''products_id_seq'');
   RETURN NEW;
END' LANGUAGE 'plpgsql'

CREATE TRIGGER "t_classes" AFTER INSERT ON "products" FOR EACH ROW EXECUTE
PROCEDURE f_products();


Roberto de Amorim  +55 48 346-2243
Software engineer at SmartBit Software
roberto@smartbit.inf.br


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: data restore
Next
From: Einar Karttunen
Date:
Subject: Re: Basic Trigger