Received: from druid.net (druid.net [216.126.72.98]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5JBhDa33191 for ; Tue, 19 Jun 2001 07:43:13 -0400 (EDT) (envelope-from darcy@druid.net) Received: by druid.net (Postfix, from userid 1000) id 716CC1A78; Tue, 19 Jun 2001 07:43:08 -0400 (EDT) Subject: Re: How to build a TRIGGER in POSTGERSQL In-Reply-To: "from Ilan Fait at Jun 18, 2001 06:02:54 pm" To: Ilan Fait Date: Tue, 19 Jun 2001 07:43:08 -0400 (EDT) Cc: "'pgsql-sql@postgresql.org'" X-Mailer: ELM [version 2.4ME+ PL78 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <20010619114308.716CC1A78@druid.net> From: darcy@druid.net (D'Arcy J.M. Cain) X-Archive-Number: 200106/285 X-Sequence-Number: 3548 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 | 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.