Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMwgr-0002ad-Uy for pgsql-sql@arkaria.postgresql.org; Mon, 19 Jun 2017 13:26:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dMwgr-0004w8-9q for pgsql-sql@arkaria.postgresql.org; Mon, 19 Jun 2017 13:26:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dMwgq-0004vk-Bt for pgsql-sql@postgresql.org; Mon, 19 Jun 2017 13:26:00 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dMwgn-0003Hw-EK for pgsql-sql@postgresql.org; Mon, 19 Jun 2017 13:25:59 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A1E4E208C6; Mon, 19 Jun 2017 09:25:56 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Mon, 19 Jun 2017 09:25:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=e5aWoi3/Org7DAF+eL BR3aURF2SwU6J4pQaY1FEIU/E=; b=BNKC3uZdB4rIdT10MjcZ6y4KZJJ6Rmo+Su n62s5gl3vgsnNd3gMmJQuAcVYrl6CFtk7gOOnD5oo+4NMOwRTEiD08SDFz1jfTS+ cqylBnk/33UOe/nEbHTjbBZz3ldwThncMPO80pXIcIDP0ZL7yNehrt+A1hhOsslM JdSwKvmSobOLwLOZtudU4L5/G40ebbXFMECN64IdhSY5AQXKy3SpVX5WI9tEF/Ch cOr4K9h2U+sR4Wja3uQ/2GjLVTZINdNAU8x/XWihNYZxG6SQxseAiv6ScAZX8Kcd ageA1t/HuuDBfpE9aVdz557CwExmaT2kwNArf/0L7VHSQNtAFzKQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=e5aWoi3/Org7DAF+eLBR3aURF2SwU6J4pQaY1FEIU/E=; b=N8OxwexP VsETYP5AfJ/9BQ71/cNLqLTwDAM687Q4TyTN+7v4GKfLwA/AHd6hMwi8nA11H2XJ j1jWdjyR5wEpt20cncl2PtCsf35ge8vesrHtSTA/lUdrdJegcfhsQ9XhOoVVuNHm akIDCNfARQbiFZa12W89Okog3rdtM9NSm6ODgX8v0suUIU210/A4eHl2bVCBdGE0 iv9tELIEryQUwPlDccLcsp8qg5IfLf2gtr0Bc/JQ87YNWczDFjSmViQgydrNKOyH pVhUhFJdcsrDege+Q/9MupmhO+Zfms4fABRDVDuY84RMsR32x31dnBaaxN5KLLpl bI7/4SyVLWir+g== X-ME-Sender: X-Sasl-enc: 0BubTTJABbUkF2hwJrx7bCUJpD34vkdoMwy51OF5ef6r 1497878756 Received: from [192.168.1.2] (75-165-115-124.tukw.qwest.net [75.165.115.124]) by mail.messagingengine.com (Postfix) with ESMTPA id 265607E96E; Mon, 19 Jun 2017 09:25:56 -0400 (EDT) Subject: Re: Find rows with "timestamp out of range" To: Saiful Muhajir , pgsql-sql@postgresql.org References: From: Adrian Klaver Message-ID: <9f45f575-7804-e771-a7c9-6906767467e2@aklaver.com> Date: Mon, 19 Jun 2017 06:25:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org 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