Re: recovery dump on database with different timezone

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Edmundo Robles <edmundo(at)sw-argos(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: recovery dump on database with different timezone
Date: 2017-01-24 01:07:17
Message-ID: 15215.1485220037@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Edmundo Robles <edmundo(at)sw-argos(dot)com> writes:
> * this the constraint: "time_stamp_201012ad" CHECK (time_stamp >=
> '2010-12-01'::date AND time_stamp < '2011-01-01'::date)

If that's on a timestamptz column, it's a seriously dangerous constraint,
because the limitations it enforces are dependent on the current timezone
setting (which will determine what is the midnight boundary for those
dates). It's entirely possible that your database is unrestorable because
different entries in the column were made under different timezone
settings and there is *no* zone value in which all of them will be able to
pass the constraint. Even if there is such a zone value, you already know
that UTC isn't it.

I'd suggest dropping the constraint in the source database (or editing the
dump file to remove it), restoring the data, and then looking to clean up
the data before you try to put the constraint back on. And this time,
express it as something like time_stamp >= '2010-12-01 00:00+00' etc ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-01-24 01:08:49 Re: recovery dump on database with different timezone
Previous Message David G. Johnston 2017-01-24 01:01:38 Re: recovery dump on database with different timezone