Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A842213364DE for ; Tue, 28 Dec 2010 22:45:58 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 43067-08 for ; Wed, 29 Dec 2010 02:45:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id E3BFD133616B for ; Tue, 28 Dec 2010 22:45:50 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id oBT2jmwX023543; Tue, 28 Dec 2010 21:45:49 -0500 (EST) To: David Rericha cc: pgsql-admin@postgresql.org Subject: Re: date out of range for timestamp In-reply-to: <4D1A9D8E.70803@healthcareoss.com> References: <4D1A7AB3.4010008@healthcareoss.com> <13702.1293586580@sss.pgh.pa.us> <4D1A9D8E.70803@healthcareoss.com> Comments: In-reply-to David Rericha message dated "Tue, 28 Dec 2010 20:31:42 -0600" Date: Tue, 28 Dec 2010 21:45:48 -0500 Message-ID: <23542.1293590748@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/199 X-Sequence-Number: 36428 [ please keep the list cc'd ] David Rericha writes: > I am truly typing the date as a literal. It turned out that I did have > a date of year 2010000, which would have been out of range, but I > changed it. But I still get the error. Hmm. Try re-running ANALYZE on the table. I'm thinking that maybe (a) the way-out-of-line date is still in the statistical histogram, and (b) the planner is using date-to-timestamp coercion while trying to estimate the selectivity of the <= condition. regards, tom lane