Re: three timestamps/table, use of 'now' in table creat

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: three timestamps/table, use of 'now' in table creat
Дата
Msg-id 96D568DD7FAAAD428581F8B3BFD9B0F604DEAE@goldmine.ecircle.de
обсуждение исходный текст
Список pgsql-general
You can use CURRENT_TIMESTAMP(0) for the default value, the "0" means no
fractional seconds.
And yes, they will be the same, because the current timestamp is frozen on
the start of the transaction.
In fact if you create more than 1 record in the same transaction, they will
ALL have the exact same timestamp applied.

HTH,
Csaba.

-----Ursprüngliche Nachricht-----
Von: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]Im Auftrag von Dennis Gearon
Gesendet: Donnerstag, 16. Januar 2003 10:08
Cc: pgsql-general@postgresql.org
Betreff: [GENERAL] three timestamps/table, use of 'now' in table
creation statement


I want to have three timestamps columns in a table:

'created'
'modified'
'archived'

not unlike more modern file systems.

What I want to happen is that all three columns get set with the 'now'
value to the nearest second, and they ALL have the exact same value.

I want to be able to compare 'created' with 'modified'
        to see if it's been modified,
I want to be able to compare 'created' with 'archived'
        to see if it's been archived.

I don't want to have NULL's with their propagation issues.

Can I use the constant 'now' in the table creation statements?

Will all three columns get assigned the same value at the start of each
record creation, or will I have some that might straddle a second
boundary and be one second apart?

How do I tell the 'now' constant to be to the second's place in
precision?


--

Carpe Dancem ;-)
-----------------------------------------------------------------
Remember your friends while they are alive
-----------------------------------------------------------------
                         Sincerely, Dennis Gearon

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

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

Предыдущее
От: Dennis Gearon
Дата:
Сообщение: three timestamps/table, use of 'now' in table creation statement
Следующее
От: Csaba Nagy
Дата:
Сообщение: Re: XML Schema and PostgreSQL