Received: from chlothar.bnv-bamberg.de (chlothar.bnv-bamberg.de [212.72.64.193]) by hub.org (8.10.1/8.10.1) with ESMTP id e558FIO78541 for ; Mon, 5 Jun 2000 04:15:19 -0400 (EDT) Received: from bnv-bamberg.de (behr@dialin-tb.bnv-bamberg.de [212.72.64.242]) by chlothar.bnv-bamberg.de (8.9.0/8.9.0) with ESMTP id KAA14346; Mon, 5 Jun 2000 10:15:13 +0200 (MET DST) Message-ID: <393B6122.5493B9F8@bnv-bamberg.de> Date: Mon, 05 Jun 2000 10:13:22 +0200 From: Thomas Behr Reply-To: thomas.behr@bnv-bamberg.de Organization: Tomfritz Muehlbehr X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14 i686) X-Accept-Language: en MIME-Version: 1.0 To: rslifka@home.com CC: pgsql-sql@postgresql.org Subject: Re: Default timestamp value References: <001101bfcec0$8683f1e0$39117118@cr699264-a.rct1.bc.wave.home.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200006/33 "Rob S." wrote: > > As a precursor to this question, I read: > > CREATE TABLE > Date/Time Types (and corresponding input/output) > Date/Time Functions > > ...but I still don't see how to have the default value of a timestamp to be > the time at which the individual record is inserted. I just get the time I > created the table. Specifically, what to put where the '?' is at. > > ... "TimeDate" TIMESTAMP DEFAULT ? ... Hallo Rob, an example, which works by me [PostgreSQL 6.4.2 on i686-pc-linux-gnu, compiled by gcc 2.7.2.]: CREATE TABLE "session" ( "zeitpunkt" timestamp DEFAULT now ( ) NOT NULL, "sid" int4 NOT NULL, "nummer" int4 NOT NULL, "status" character varying NOT NULL, "host" inet); Ade Thomas > > I tried 'now' and 'current' but it just makes the default value the time > when I create the table, and 'current' gives me the word 'current' back in > psql, so I imagine I'm not taking that in quite the right way =) I can see > why it does this for both of these, althought in the docs, it says current > is current time, deferred, but I dunno what that means. > > Any help or pointers to a nice resource? IMHO, the PG docs are a great > reference, but not much in the way of terrific examples =) > > - r