DEFAULT now() ?

From: "ty" <ty(at)koi(dot)tsukebe(dot)net>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: DEFAULT now() ?
Date: 2000-04-18 10:36:53
Message-ID: 000e01bfa922$03466330$a20efea9@indus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

May someone please show me the necessary code snippets that would allow the value of a column to take the current time ( ala now() ) by default on INSERT?

Indicative example:

CREATE TABLE foo (
a INTEGER NOT NULL DEFAULT 0,
b DATETIME NOT NULL DEFAULT now()
);

INSERT INTO foo (a) VALUES (123);

What happens here? Well, a row is inserted into table ``foo'' where ``a'' has the value 123 and b holds the date & time of when the create DDL statement was executed. I'm wondering how to get b to have the value of the time whenever any arbitrary insert statement is executed...

Ty

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Raul Carvalho 2000-04-18 10:58:11 RE: Maintenance
Previous Message Loïc TREGOUËT 2000-04-18 09:58:21 This Object side of postgresql