pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laszlo Nagy <gandalf@shopzeus.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Messed up time zones
Date: Fri, 03 Aug 2012 10:19:44 -0400
Message-ID: <16399.1344003584@sss.pgh.pa.us> (raw)
In-Reply-To: <501BAE33.4090102@shopzeus.com>
References: <501B8C6F.6040100@shopzeus.com>
	<501BAA84.9010306@shopzeus.com>
	<501BAE33.4090102@shopzeus.com>

Laszlo Nagy <gandalf@shopzeus.com> writes:
> So how do I create a query that results in something like:

>             a
> ------------------------------
>   Sun Oct 30 02:00:00 2011 +0500
>   Sun Oct 30 02:00:00 2011 +0600
> (2 rows)

Set the "timezone" setting to the zone you have in mind, and then just
print the values.  The reason there's no manual way to do rotation
across zones is that there's no need for one because it's done
automatically during printout of a timestamptz value.

I suspect that you have not correctly internalized what timestamptz
values actually are.  Internally they are just time values specified in
UTC (or UT1 if you want to be picky).  On input, the value is rotated
from whatever zone is specified in the string (or implicitly specified
by "timezone") to UTC.  On output, the value is rotated from UTC to
whatever the current "timezone" setting is.

			regards, tom lane



view thread (17+ messages)  latest in thread

Message-ID: <16399.1344003584@sss.pgh.pa.us>
Permalink:  ../16399.1344003584@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16399.1344003584@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gandalf@shopzeus.com, pgsql-admin@postgresql.org
  Subject: Re: Messed up time zones
  In-Reply-To: <16399.1344003584@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox