Unexpected behaviour of date_part

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Unexpected behaviour of date_part
Date: 2009-06-29 08:49:33
Message-ID: D960CB61B694CF459DCFB4B0128514C202FF668A@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is PostgreSQL 8.4, but the behaviour has not changed from earlier versions:

test=> SHOW timezone;
TimeZone
---------------
Europe/Vienna
(1 row)

test=> SELECT date_part('timezone_hours', timestamp with time zone '2009-06-26 10:05:57.46624+11');
date_part
-----------
2
(1 row)

2 being the offset of my local time zone.

Now an EXPLAIN shows that this is due to the fact that the timestamp
is converted to my local time zone before it is submitted to the function,
but I think that this result is undesirable and misleading.

Yours,
Laurenz Albe

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2009-06-29 09:09:55 Re: masking the code
Previous Message Роман Маширов 2009-06-29 08:49:22 Re: pasting into psql garbles text