pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SYSDATE in PostgreSQL !?
2+ messages / 2 participants
[nested] [flat]

* SYSDATE in PostgreSQL !?
@ 2004-03-01 21:18  Louie Kwan <lkwan@nuvo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Louie Kwan @ 2004-03-01 21:18 UTC (permalink / raw)
  To: pgsql-sql

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 ?

Any help is appreciated. 


CREATE TABLE channels    (
 channelID                  NUMBER PRIMARY KEY,
 name                         VARCHAR2(64) NOT NULL,
 status                        INTEGER NOT NULL,
 remedyID                   VARCHAR2(15) UNIQUE,
 remedySchemaID       NUMBER default 48,
 remedyLastModified    INTEGER,
 updateTimeStamp      DATE default (SYSDATE),
 createTimeStamp       DATE default (SYSDATE)
);


Regards,
Louie Kwan




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: SYSDATE in PostgreSQL !?
@ 2004-03-01 22:57  Oliver Elphick <olly@lfix.co.uk>
  parent: Louie Kwan <lkwan@nuvo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Elphick @ 2004-03-01 22:57 UTC (permalink / raw)
  To: Louie Kwan <lkwan@nuvo.com>; +Cc: 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().





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-03-01 22:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-03-01 21:18 SYSDATE in PostgreSQL !? Louie Kwan <lkwan@nuvo.com>
2004-03-01 22:57 ` Oliver Elphick <olly@lfix.co.uk>

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