Re: SYSDATE in PostgreSQL !?

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Louie Kwan <lkwan(at)nuvo(dot)com>
Cc: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: SYSDATE in PostgreSQL !?
Date: 2004-03-01 22:57:28
Message-ID: 1078181848.2603.23.camel@cerberus.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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().

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Terence Kearns 2004-03-01 23:57:27 Re: returning a recordset from PLpg/SQL
Previous Message Manuel Sugawara 2004-03-01 22:32:50 Re: select by groups