pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: Louie Kwan <lkwan@nuvo.com>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: SYSDATE in PostgreSQL !?
Date: Mon, 01 Mar 2004 22:57:28 +0000
Message-ID: <1078181848.2603.23.camel@cerberus.lfix.co.uk> (raw)
In-Reply-To: <FB4FDC17A002D711BC0C009027DE84AF027F6BF3@EXCHANGE.nuvo.com>
References: <FB4FDC17A002D711BC0C009027DE84AF027F6BF3@EXCHANGE.nuvo.com>

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





view thread (2+ messages)

Message-ID: <1078181848.2603.23.camel@cerberus.lfix.co.uk>
Permalink:  ../1078181848.2603.23.camel@cerberus.lfix.co.uk/
Also on:    postgresql.org/message-id/1078181848.2603.23.camel@cerberus.lfix.co.uk

 · 

reply

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: olly@lfix.co.uk, lkwan@nuvo.com
  Subject: Re: SYSDATE in PostgreSQL !?
  In-Reply-To: <1078181848.2603.23.camel@cerberus.lfix.co.uk>

* 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