From: darcy@druid.net
To: Ilan Fait <ilan@iweb.com>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: How to build a TRIGGER in POSTGERSQL
Date: Tue, 19 Jun 2001 07:43:08 -0400 (EDT)
Message-ID: <20010619114308.716CC1A78@druid.net> (raw)
In-Reply-To: <C9E46ACE328FD311B70200508B91AD8CA8FE9E@EXCHANGE>
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@{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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: darcy@druid.net, ilan@iweb.com
Subject: Re: How to build a TRIGGER in POSTGERSQL
In-Reply-To: <20010619114308.716CC1A78@druid.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox