Обсуждение: How to put into 'now' into a datetime field

Поиск
Список
Период
Сортировка

How to put into 'now' into a datetime field

От
Martin Neumann
Дата:
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