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