Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XA2JE-0000tj-8q for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Jul 2014 19:34:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XA2JD-0005DZ-Mb for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Jul 2014 19:34:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XA2Hz-0004AK-Od for pgsql-jdbc@postgresql.org; Wed, 23 Jul 2014 19:33:23 +0000 Received: from hogranch.com ([75.101.82.47]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XA2Hv-0006g9-P5 for pgsql-jdbc@postgresql.org; Wed, 23 Jul 2014 19:33:22 +0000 Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id s6NJXEZ19346 for ; Wed, 23 Jul 2014 12:33:14 -0700 Message-ID: <53D00DF5.3030806@hogranch.com> Date: Wed, 23 Jul 2014 12:33:09 -0700 From: John R Pierce User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Upgrade to Scientific Linux 6.5 x86_64 breaks query References: <1406131842.96108.YahooMailNeo@web162901.mail.bf1.yahoo.com> <1406142837.33674.YahooMailNeo@web162903.mail.bf1.yahoo.com> In-Reply-To: <1406142837.33674.YahooMailNeo@web162903.mail.bf1.yahoo.com> Content-Type: multipart/alternative; boundary="------------030907000409070202040003" X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Pg-Spam-Score: -1.9 (-) 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 This is a multi-part message in MIME format. --------------030907000409070202040003 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 7/23/2014 12:13 PM, CG wrote: > The parenthesis don't work, but if I explicitly cast that second > parameter to interval "CAST( $2 AS interval)" I can force it to work. > That's not ideal. > > I don't think it is the lack of an operator. Timestamptz should not be > comparable directly to an interval, right? That's like saying "2 + 2 > >= Orange" or "today is greater than a minute". I think something is > eating that first "now() -" so that what is being prepared looks like > "trans_date between $2 and now()". > > The question is what is causing valid SQL, prepared properly on 32bit > linux to fail to prepare properly on 64bit linux? Based on that log, > it looks like client-side prepare is falling down. I think I'd try some experiments with select pg_typeof($1), passing it your 'interval' value and see what it thinks it is. test=# select pg_typeof(interval '1 day'); pg_typeof ----------- interval (1 row) test=# select pg_typeof('1 day'); pg_typeof ----------- unknown (1 row) -- john r pierce 37N 122W somewhere on the middle of the left coast --------------030907000409070202040003 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 7/23/2014 12:13 PM, CG wrote:
The parenthesis don't work, but if I explicitly cast that second parameter to interval "CAST( $2 AS interval)" I can force it to work. That's not ideal.

I don't think it is the lack of an operator. Timestamptz should not be comparable directly to an interval, right? That's like saying "2 + 2 >= Orange" or "today is greater than a minute". I think something is eating that first "now() -" so that what is being prepared looks like "trans_date between $2 and now()".

The question is what is causing valid SQL, prepared properly on 32bit linux to fail to prepare properly on 64bit linux? Based on that log, it looks like client-side prepare is falling down.

I think I'd try some experiments with  select pg_typeof($1),    passing it your 'interval' value and see what it thinks it is.


test=# select pg_typeof(interval '1 day');
 pg_typeof
-----------
 interval
(1 row)

test=# select pg_typeof('1 day');        
 pg_typeof
-----------
 unknown
(1 row)


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast
--------------030907000409070202040003--