agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Saiful Muhajir <saifulmuhajir@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Find rows with "timestamp out of range"
Date: Mon, 19 Jun 2017 06:25:55 -0700
Message-ID: <9f45f575-7804-e771-a7c9-6906767467e2@aklaver.com> (raw)
In-Reply-To: <CAA0dH_v08fBFWp+4TsRz8wESSp8zgKCL_Sdc-OVdA3vQd_XjUg@mail.gmail.com>
References: <CAA0dH_v08fBFWp+4TsRz8wESSp8zgKCL_Sdc-OVdA3vQd_XjUg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.klaver@aklaver.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (8+ messages)  latest in thread

Message-ID: <9f45f575-7804-e771-a7c9-6906767467e2@aklaver.com>
Permalink:  ../9f45f575-7804-e771-a7c9-6906767467e2@aklaver.com/
Also on:    postgresql.org/message-id/9f45f575-7804-e771-a7c9-6906767467e2@aklaver.com

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-sql@postgresql.org
  Cc: adrian.klaver@aklaver.com, saifulmuhajir@gmail.com
  Subject: Re: Find rows with "timestamp out of range"
  In-Reply-To: <9f45f575-7804-e771-a7c9-6906767467e2@aklaver.com>

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

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