pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dave Cramer <pg@fastcrypt.com>
Cc: CG <cgg007@yahoo.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: Upgrade to Scientific Linux 6.5 x86_64 breaks query
Date: Wed, 23 Jul 2014 14:47:20 -0400
Message-ID: <23137.1406141240@sss.pgh.pa.us> (raw)
In-Reply-To: <CADK3HHKRFUVJw_zkyP5+1pjTFz6Zmjy1=tjXrvvEEg60pDZvxA@mail.gmail.com>
References: <1406131842.96108.YahooMailNeo@web162901.mail.bf1.yahoo.com>
	<CADK3HHKRFUVJw_zkyP5+1pjTFz6Zmjy1=tjXrvvEEg60pDZvxA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Dave Cramer <pg@fastcrypt.com> 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.

			regards, tom lane


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



view thread (11+ messages)  latest in thread

Message-ID: <23137.1406141240@sss.pgh.pa.us>
Permalink:  ../23137.1406141240@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23137.1406141240@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pg@fastcrypt.com, cgg007@yahoo.com
  Subject: Re: Upgrade to Scientific Linux 6.5 x86_64 breaks query
  In-Reply-To: <23137.1406141240@sss.pgh.pa.us>
  References: <1406131842.96108.YahooMailNeo@web162901.mail.bf1.yahoo.com> <CADK3HHKRFUVJw_zkyP5+1pjTFz6Zmjy1=tjXrvvEEg60pDZvxA@mail.gmail.com> <23137.1406141240@sss.pgh.pa.us>

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

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