Re: Basic Trigger

From: Einar Karttunen <ekarttun(at)cs(dot)helsinki(dot)fi>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Basic Trigger
Date: 2002-11-18 11:30:15
Message-ID: 20021118113015.GA19319@melkinpaasi.cs.Helsinki.FI
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-11-18 11:40:03 Re: Basic Trigger
Previous Message Roberto de Amorim 2002-11-18 11:13:25 Basic Trigger