Re: Date column that defaults to 'now'

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: Date column that defaults to 'now'
Дата
Msg-id 1073337495.25138.1379.camel@linda.lfix.co.uk
обсуждение исходный текст
Ответ на Date column that defaults to 'now'  (John Siracusa <siracusa@mindspring.com>)
Список pgsql-general
On Mon, 2004-01-05 at 21:00, John Siracusa wrote:
> How can I create a non-null date column that defaults to 'now' as computed
> at the time the row is inserted?

The default should be either CURRENT_DATE or timeofday()::DATE

The difference is that CURRENT_TIME, CURRENT_TIMESTAMP and CURRENT_DATE
remain the same within a transaction even if the time or date changes,
whereas timeofday() always returns the current clock time.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "And thou shalt love the LORD thy God with all thine
      heart, and with all thy soul, and with all thy might."
                 Deuteronomy 6:5


В списке pgsql-general по дате отправления:

Предыдущее
От: "Roderick A. Anderson"
Дата:
Сообщение: Re: Scripting a new db server setup
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Date column that defaults to 'now'