Re: Basic Trigger - Mailing list pgsql-general

From Einar Karttunen
Subject Re: Basic Trigger
Date
Msg-id 20021118113015.GA19319@melkinpaasi.cs.Helsinki.FI
Whole thread Raw
In response to Basic Trigger  ("Roberto de Amorim" <roberto@smartbit.inf.br>)
List pgsql-general
On 18.11 09:13, Roberto de Amorim wrote:
> 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?

Why not use serial datatype in this case?
http://www.postgresql.org/idocs/index.php?datatype.html#DATATYPE-SERIAL

If you want to have a trigger inserting a default a value, why
not just add a DEFAULT clause to the table definition / use
alter table?

If you want to create the trigger by yourself, first read:
http://www.postgresql.org/idocs/index.php?triggers.html

- Einar Karttunen

pgsql-general by date:

Previous
From: "Roberto de Amorim"
Date:
Subject: Basic Trigger
Next
From: Stephan Szabo
Date:
Subject: Re: Basic Trigger