Re: Find rows with "timestamp out of range"

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Saiful Muhajir <saifulmuhajir(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Find rows with "timestamp out of range"
Date: 2017-06-19 13:25:55
Message-ID: 9f45f575-7804-e771-a7c9-6906767467e2@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 06/19/2017 12:11 AM, Saiful Muhajir wrote:
> Hi,
>
> I have a table with around *133 million rows* with two timestamp
> columns. While trying to copy some columns for a new database, using
> *\COPY *, the error occurred with: *timestamp out of range*
>
> ​While trying to​ figure out the rows containing the out of range value,
> I am using this with no result:
>
>
> *select comment_id, create_time from comments where create_time > '1 Jan
> 9999';
> * comment_id │ talk_id │ create_time
> ────────────┼─────────┼─────────────
> (0 rows)
>
> The error occurred when I query with:
>
>
> *select comment_id, create_time from comments where create_time < '1 Jan
> 1800';*
> ERROR: 22008: timestamp out of range
> LOCATION: timestamp_out, timestamp.c:226

Do you really have timestamps in create_time that are before '1 Jan 1800'?

To put it another way, what is the range of values you would expect for
create_time?

>
>
> So, how do I figure out the rows with problems?

When you did the \copy and got the error, did it give you a row number
for the error?

Have you ever had the database or computer crash?

>
>
> Thank you.
>
> --
> Regards,
>
> Saiful

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2017-06-19 13:33:10 Re: Find rows with "timestamp out of range"
Previous Message Samed YILDIRIM 2017-06-19 08:37:34 Re: Find rows with "timestamp out of range"