LINUX.ORG.RU
ФорумAdmin

Странное для меня поведение Postgres


0

0

У меня разрыв мозга. Ну почему так ???? Проблема: 

voip=> insert into call_records(starttime) values('2007-04-20 15:10:00+03:00'); INSERT 102836416 1 voip=> select * from call_records; id | duration | starttime | endtime | callerip | callerport | calledip | calledport | destinfo | srcinfo | gkid | sessionid ---------+----------+------------------------+---------+----------+------------+
 ----------+------------+----------+---------+------+----------- 2398818 | | 2007-04-20 08:10:00-04 | | | | | | | | | (1 запись) 

То есть вставляется GMT+03, а получается -04. Я конечно понимаю что 15:10:00+03 то же самое что 2007-04-20 08:10:00-04, но хочется чтобы было также, а то скрипт не работает один унаследованный. 

Некоторая дополнительная инфа: 

voip=> \d call_records; Таблица "public.call_records" Колонка | Тип | Модификаторы ----------------+--------------------------+------------------------------------
 --------------------- id | integer | not null default nextval('"call_records_id_seq"'::text) duration | integer | starttime | timestamp with time zone | endtime | timestamp with time zone | callerip | inet | callerport | integer | calledip | inet | calledport | integer | destinfo | character varying(30) | srcinfo | character varying(30) | gkid | character varying(30) | sessionid | character varying(24) | Индексы: "call_records_pkey" PRIMARY KEY, btree (id) "call_records_id_key" UNIQUE, btree (id) "starttime_idx" btree (starttime) 

voip=> \q [root@onyx var]# date Птн Апр 20 15:17:05 MSD 2007 

[root@onyx pgsql]# cat postgresql.conf | grep "lc_\|timezone" #timezone = unknown # actually, defaults to TZ environment setting #australian_timezones = false lc_messages = 'ru_RU.UTF-8' # locale for system error message strings lc_monetary = 'ru_RU.UTF-8' # locale for monetary formatting lc_numeric = 'ru_RU.UTF-8' # locale for number formatting lc_time = 'ru_RU.UTF-8' # locale for time formatting

тут не только мозга разрыв, а ещё и рук тоже

theserg ★★★
()

Попробуй перед выполнением запроса сделать set timezone='+3';

anonymous
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.