Re: PostgreSQL Timezone and Brazilian DST

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Edson Richter <edsonrichter(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL Timezone and Brazilian DST
Date: 2015-10-28 13:56:40
Message-ID: 5630D418.60407@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/27/2015 10:43 PM, Edson Richter wrote:
> ---- Adrian Klaver escreveu ----
>
> > On 10/27/2015 07:29 PM, Edson Richter wrote:
> > > Hi!
> > >
> > > Using PostgreSQL 9.3.10 x86_64 Oracle EL7 compiled by gcc (GCC) 4.8.3
> > > 20140911, installed using yum repository.
> > >
> > > In postgresql.conf, I do have:
> > >
> > > timezone="America/Sao_Paulo"
> > >
> > > Since DST is in place in Brazil, it is enough to "systemctl reload
> > > postgresql-9.3" to make it effective?
> >
> > Are you saying that you just changed the timezone setting or that time
> > in Brazil just went from standard time to DST and you want to know
> > whether Postgres will automatically pick that up with the existing
> > setting as above?
>
> Configured since first setup. Brazil went DST few days ago.
> Today, executing
>
> Select now()
> Resulted in
>
> 2015-10-28 02:45:37-03:00
>
> I do expect
>
> 2015-10-28 03:45:37-02:00
>
> I suspect that Postgres is ignoring the DST change.

Well it works for me here:

test=> set timezone="America/Sao_Paulo";
SET
test=> select now();
now
-------------------------------
2015-10-28 11:30:21.050485-02

So first thing I would do is see what is actually set in client:

test=> show timezone;
TimeZone
-------------------
America/Sao_Paulo

If it is not what you think it should be then:

test=> select * from pg_settings where name = 'TimeZone';

-[ RECORD 1 ]---------------------------------------------------------------
name | TimeZone
setting | America/Sao_Paulo
unit |
category | Client Connection Defaults / Locale and Formatting
short_desc | Sets the time zone for displaying and interpreting time stamps.
extra_desc |
context | user
vartype | string
source | session
min_val |
max_val |
enumvals |
boot_val | GMT
reset_val | US/Pacific
sourcefile |
sourceline |

Here for more info:
http://www.postgresql.org/docs/9.3/interactive/view-pg-settings.html

In particular, context and source.

>
> I just want to know if reload or restart is enough to make Postgres get
> into track.

No, if the above does not indicate a problem, then the issue is
probably, as Francisco said, in the timezone definitions. The thing is,
you are on 9.3.10 which has the latest time zone data file:

http://www.postgresql.org/docs/9.3/interactive/release-9-3-10.html

Update time zone data files to tzdata release 2015g for DST law changes
in Cayman Islands, Fiji, Moldova, Morocco, Norfolk Island, North Korea,
Turkey, and Uruguay. There is a new zone name America/Fort_Nelson for
the Canadian Northern Rockies.

>
> Thanks,
>
> Edson
>
> >
> > > Or a complete restart is required?
> > >
> > > Thanks,
> > >
> >
> >
> > --
> > Adrian Klaver
> > adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
> >
> >
> > --
> > Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org
> <mailto:pgsql-general(at)postgresql(dot)org>)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-general
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-10-28 14:06:08 Re: PostgreSQL Timezone and Brazilian DST
Previous Message Jim Nasby 2015-10-28 13:20:21 Re: Partitioning table by multiple columns