timeofday() and clock_timestamp() produce different results when casting to timestamptz

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: timeofday() and clock_timestamp() produce different results when casting to timestamptz
Date: 2013-03-23 07:37:47
Message-ID: CAL_0b1sm4deeNyRo6bJWHObTG00EPH9bMqGrGpv_84XkOYUe7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi all,

Today after upgrading to 9.2 from 9.0 I faced a very odd
incompatibility that seems to me as a bug:

smoking_test=# select timeofday(), clock_timestamp();
timeofday | clock_timestamp
-------------------------------------+-------------------------------
Sat Mar 23 11:20:54.023796 2013 MSK | 2013-03-23 11:20:54.023815+04

smoking_test=# select timeofday()::timestamptz, clock_timestamp()::timestamptz;
timeofday | clock_timestamp
-------------------------------+-------------------------------
2013-03-23 12:21:03.995653+04 | 2013-03-23 11:21:03.995695+04

As you can see after casting timeofday() to timestamp with time zone
it adds one hour to the timestamp when clock_timestamp() behaves
normally.

Timezone is Europe/Moscow. Version information:

smoking_test=# select version();
version
---------------------------------------------------------------------------------------------------------------
PostgreSQL 9.2.3 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.1.2 20080704 (Red Hat 4.1.2-52), 64-bit

--
Sergey Konoplev
Database and Software Architect
http://www.linkedin.com/in/grayhemp

Phones:
USA +1 415 867 9984
Russia, Moscow +7 901 903 0499
Russia, Krasnodar +7 988 888 1979

Skype: gray-hemp
Jabber: gray(dot)ru(at)gmail(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Denver Timothy 2013-03-23 09:51:06 Re: PostgreSQL EXCLUDE USING error: Data type integer has no default operator class
Previous Message Jov 2013-03-23 03:03:58 Re: Group by -- precedence question

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-03-23 09:43:51 Re: Page replacement algorithm in buffer cache
Previous Message Josh Kupershmidt 2013-03-23 05:13:00 Re: pg_dump/restore syntax checking bug?