How to put into 'now' into a datetime field - Mailing list pgsql-sql

From Martin Neumann
Subject How to put into 'now' into a datetime field
Date
Msg-id m11OEe6-000DJ3C@darwin.oche.de
Whole thread Raw
List pgsql-sql
table foobar { [...] created datetime NOT NULL DEFAULT x
}

I want to put the current transaction time into
"created" when inserting into the table. After reading the manual
I've tried the following combinations for x:

'now'
''now''
(''now'')
('now')
datetime('now')
datetime(''now'')
datetime('now'::abstime)
'now'::datetime
('now'::datetime)

And perhaps some more I forgot. The only one not resulting in an
syntax error when creating the table is 'now'. But using simply 'now'
gives a strange result:

When I insert the first tuple the datetime-value is okay.
But when I insert further tuples they get the same datetime-value
as the first inserted tuple.

-- 
Martin Neumann
mne@mne.de


pgsql-sql by date:

Previous
From: Dipankar Chakrabarti
Date:
Subject: Re:Stored Procs
Next
From: leonardo albrizio
Date:
Subject: (no subject)