DEFAULT now() ? - Mailing list pgsql-admin

From ty
Subject DEFAULT now() ?
Date
Msg-id 000e01bfa922$03466330$a20efea9@indus
Whole thread Raw
Responses Re: DEFAULT now() ?  (Margarita Barvinok <brita@umich.edu>)
List 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
 

pgsql-admin by date:

Previous
From: Loïc TREGOUËT
Date:
Subject: This Object side of postgresql
Next
From: Raul Carvalho
Date:
Subject: RE: Maintenance