From: | darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain) |
---|---|
To: | Ilan Fait <ilan(at)iweb(dot)com> |
Cc: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: How to build a TRIGGER in POSTGERSQL |
Date: | 2001-06-19 11:43:08 |
Message-ID: | 20010619114308.716CC1A78@druid.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Thus spake Ilan Fait
> 1) I need to build a trigger that every time I insert into the table
> one of the columns will get +1 number.
The easiest way in PostgreSQL is to simply make the field a serial type.
CREATE TABLE mytable (
id SERIAL PRIMARY KEY,
myname TEXT);
> 2) what is equal to 'sysdate' (to get/put the system date in a
> table) in PostGerSQL.
Again, the table definition can handle this.
CREATE TABLE mytable (
id SERIAL PRIMARY KEY,
mydate DATE DEFAULT CURRENT_DATE,
myname TEXT);
You should check out the docs on the web site. They are quite comprehensive.
--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
From | Date | Subject | |
---|---|---|---|
Next Message | David BOURIAUD | 2001-06-19 12:10:16 | About primary keys. |
Previous Message | Tom Lane | 2001-06-19 06:09:53 | Re: Sequence behaviour. |