From: | Csaba Nagy <nagy(at)domeus(dot)de> |
---|---|
To: | "'Dennis Gearon'" <gearond(at)cvc(dot)net> |
Cc: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: three timestamps/table, use of 'now' in table creat |
Date: | 2003-01-16 09:21:14 |
Message-ID: | 96D568DD7FAAAD428581F8B3BFD9B0F604DEAE@goldmine.ecircle.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]Im Auftrag von Dennis Gearon
Gesendet: Donnerstag, 16. Januar 2003 10:08
Cc: pgsql-general(at)postgresql(dot)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?
From | Date | Subject | |
---|---|---|---|
Next Message | Csaba Nagy | 2003-01-16 10:44:44 | Re: XML Schema and PostgreSQL |
Previous Message | Dennis Gearon | 2003-01-16 09:08:09 | three timestamps/table, use of 'now' in table creation statement |