The following bug has been logged online:
Bug reference: 1598
Logged by: Nicolas HAHN
Email address: [EMAIL PROTECTED]
PostgreSQL version: 7.4.7
Operating system: Fedora Core 3
Description: using default 'now', or now() or CURRENT_TIMESTAMP when
creating table does not work as expected
Details:
********************** case 2: using default now(), which doesn't work as expected according the doc:
BEGIN; CREATE TABLE test (date timestamp not null default now(), val varchar(64)); INSERT INTO test (val) values ('test 1 at time T'); ########### Here I wait 1 minute ############# INSERT INTO test (val) values ('test 2 at time T+1 min'); SELECT * from test; date | val ----------------------------+------------------------ 2005-04-15 13:50:53.419981 | test 1 at time T 2005-04-15 13:50:53.419981 | test 2 at time T+1 min (2 rows) ROLLBACK;
This particular case will give the same time because it is all in the same transaction. CURRENT_TIMESTAMP/now() are "frozen" at start of transaction, so you can store several timestamps with the same value.
Try commit/begin where you wait for one minute - that should do it.
Alternatively, look at timeofday() instead.
-- Richard Huxton Archonet Ltd
---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])