Re: [GENERAL] recovery dump on database with different timezone - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] recovery dump on database with different timezone
Date
Msg-id 15215.1485220037@sss.pgh.pa.us
Whole thread Raw
In response to [GENERAL] recovery dump on database with different timezone  (Edmundo Robles <edmundo@sw-argos.com>)
List pgsql-general
Edmundo Robles <edmundo@sw-argos.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


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] recovery dump on database with different timezone
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] recovery dump on database with different timezone