Strange behavior with timestamptz

Поиск
Список
Период
Сортировка
От George Weaver
Тема Strange behavior with timestamptz
Дата
Msg-id 006801c36b35$524ecac0$4f0da18e@cleartag
обсуждение исходный текст
Ответы Re: Strange behavior with timestamptz
Список pgsql-sql
Hi Everyone,
 
I have a situation where two tables have a "Created" field defined as follows:
 
table seedlot             "created  timestamptz  DEFAULT now(), "
 
table transaction        "created  timestamptz  NOT NULL  DEFAULT now(),"
 
The transaction table records when a seedlot record is created, with both events happening in the same plpgsql function.  The seedlot record is created first, with the transaction table being updated later in the procedure.
 
Seedlot 153 was received on August 11 with the following result:
 
base=# select created from seedlot where syslotid=153;
        created
------------------------
 2003-11-08 12:13:39-06
(1 row)
 
base=# select created from transaction where syslotid=153 and transactiontypeid=22;
        created
------------------------
 2003-08-11 12:13:39-05
(1 row)
 
Does anyone have any idea why the default for seedlot recorded the time with the day and month switched, resulting in the seedlot record being stamped Nov 8, 2003 while the transaction was stamped correctly as Aug 11, 2003?
 
In the same function a number of other records are created and timestamped.  In all cases where the table definition statement does not include NOT NULL, the time was stamped with the day and month reversed.
 
However! Two of the tables define created thus:
 
  "created  timestamptz   DEFAULT now() NOT NULL,"
 
but still ended up with the day and month being switched.
 
The transaction record is the last one in the procedure to be created.
 
I am using version 7.3.2.
 
I hope I'm not missing something obvious...
 
Thanks for your help,
George

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

Предыдущее
От: Michele Bendazzoli
Дата:
Сообщение: Re: [ZODB-Dev] What are the ZopeDB limit?
Следующее
От: Joseph Shraibman
Дата:
Сообщение: How to join from two tables at once?