How to put into 'now' into a datetime field

Поиск
Список
Период
Сортировка
От Martin Neumann
Тема How to put into 'now' into a datetime field
Дата
Msg-id m11OEe6-000DJ3C@darwin.oche.de
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Dipankar Chakrabarti
Дата:
Сообщение: Re:Stored Procs
Следующее
От: leonardo albrizio
Дата:
Сообщение: (no subject)