X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 922E5D1D2BA for ; Mon, 1 Mar 2004 22:57:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 39017-04 for ; Mon, 1 Mar 2004 18:57:34 -0400 (AST) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id 54166D1BB95 for ; Mon, 1 Mar 2004 18:57:31 -0400 (AST) Received: from lfix.demon.co.uk ([80.177.205.209] helo=cerberus.lfix.co.uk) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 1AxwLs-000IXe-0Y; Mon, 01 Mar 2004 22:57:32 +0000 Received: from localhost ([127.0.0.1]) by cerberus.lfix.co.uk with esmtp (Exim 4.30) id 1AxwLo-0001hK-Qv; Mon, 01 Mar 2004 22:57:28 +0000 Subject: Re: SYSDATE in PostgreSQL !? From: Oliver Elphick Reply-To: olly@lfix.co.uk To: Louie Kwan Cc: "'pgsql-sql@postgresql.org'" In-Reply-To: References: Content-Type: text/plain Organization: LFIX Ltd Message-Id: <1078181848.2603.23.camel@cerberus.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Mon, 01 Mar 2004 22:57:28 +0000 Content-Transfer-Encoding: 7bit X-LFIX-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/14 X-Sequence-Number: 17113 On Mon, 2004-03-01 at 21:18, Louie Kwan wrote: > How can I define a table with columns with sysdate as the default value.. > > If there is no SYSDATE defined in PostgreSQL , what can I do ? > CREATE TABLE channels ( ... > updateTimeStamp DATE default (SYSDATE), > createTimeStamp DATE default (SYSDATE) > ); updateTimeStamp DATE DEFAULT CURRENT_DATE or possibly updateTimeStamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP which will give you time as well as date. Perhaps you should also add NOT NULL. CURRENT_* doesn't change within a transaction. If you need to record real time, use timeofday().