Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XA1gu-0006pk-8N for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Jul 2014 18:55:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XA1gs-0004hE-V6 for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Jul 2014 18:55:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XA1gr-0004gy-Sf for pgsql-jdbc@postgresql.org; Wed, 23 Jul 2014 18:55:02 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XA1gj-0008DM-SE for pgsql-jdbc@postgresql.org; Wed, 23 Jul 2014 18:54:59 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1XA1gi-0000mo-Ko for pgsql-jdbc@postgresql.org; Wed, 23 Jul 2014 11:54:52 -0700 Date: Wed, 23 Jul 2014 11:54:52 -0700 (PDT) From: David G Johnston To: pgsql-jdbc@postgresql.org Message-ID: <1406141692624-5812574.post@n5.nabble.com> In-Reply-To: <23137.1406141240@sss.pgh.pa.us> References: <1406131842.96108.YahooMailNeo@web162901.mail.bf1.yahoo.com> <23137.1406141240@sss.pgh.pa.us> Subject: Re: Upgrade to Scientific Linux 6.5 x86_64 breaks query MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Tom Lane-2 wrote > Dave Cramer < > pg@ > > writes: >> The crux of the problem is this: ERROR: operator does not exist: >> timestamp >> with time zone >= interval >> which appears to be caused by trans_date between now() - $2 and now() > >> What happens if you change it to : >> trans_date between (now() - $2) and now() > > That shouldn't change the results... > > I think the real issue here is what is the datatype of parameter $2. > It's apparently intended to be an interval (so that now() - interval > is a timestamp, and the comparison is meaningful.) But the new system > is evidently taking $2 as a timestamp: the timestamp minus timestamp > operator yields an interval (which is unsurprising if you think about > what it means), and that leads to the reported error when the parser > tries to figure out what the BETWEEN means. > > I would bet that in the old system $2 was explicitly marked as an interval > value, but in the new system $2 isn't getting marked with any particular > datatype. Given "timestamp minus unknown", the parser will resolve > the unknown type as timestamp, the same as is on the other side of the > operator. (Obviously, that heuristic doesn't work all the time, but > it's right much of the time.) > > So I think this is a client-side behavioral change, and what you need to > look for is how the type of that parameter is getting set, or not. Agreed though the detail provided shows: $2=<0 years 0 mons 0 days 1 hours 0 mins 0.00 which leads me to believe the server is indeed getting an interval from the client... The OP should also try explicitly casting the parameter symbol in the original query: trans_date between now() - ?::interval and now() David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Upgrade-to-Scientific-Linux-6-5-x86-64-breaks-query-tp5812546p5812574.html Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com. -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc