pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: javadesigner <javadesigner@yahoo.com>
To: List <pgsql-jdbc@postgresql.org>
Subject: Re: PreparedStatement error upon trying to set a '?' after interval keyword
Date: Fri, 15 Aug 2014 11:46:59 -0400
Message-ID: <53EE2B73.4060308@yahoo.com> (raw)
In-Reply-To: <CAH7T-aoPABiZyCqSy6cVDxKRH6KGrWfi-NAVMUSxFSLPNQ=s-A@mail.gmail.com>
References: <53E9144B.4010404@yahoo.com>
	<CAH7T-apf-tXft3=y91AwnybTNcvcsUtMdP1DAmtbDj+jgwZpJg@mail.gmail.com>
	<53E991F0.5000109@2ndquadrant.com>
	<CAH7T-aoPABiZyCqSy6cVDxKRH6KGrWfi-NAVMUSxFSLPNQ=s-A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Sehrope, Craig:

Thanks a ton for your help. And hopefully this thread (and these 
detailed answers) will be searchable for people who may have similar 
questions in the future.

Best,
-j

Sehrope Sarkuni wrote:
> Yes Craig's way is better. I was only thinking of handling the string
> interpolation itself rather than generating the interval itself.
>
> I'd probably use the ::interval cast syntax though, so something like:
> checkin_time>  (CURRENT_DATE - (? * '1 day'::interval))
>
> Regards,
> -- Sehrope Sarkuni
> Founder&  CEO | JackDB, Inc. | http://www.jackdb.com/
>
> On Tue, Aug 12, 2014 at 12:02 AM, Craig Ringer<craig@2ndquadrant.com>  wrote:
>> On 08/12/2014 04:34 AM, Sehrope Sarkuni wrote:
>>>      AND checkin_time>  (CURRENT_DATE - (? || ' days')::interval)
>>
>> It's generally preferable to write
>>
>> (? * INTERVAL '1' DAY)
>>
>> instead.
>>
>> --
>>   Craig Ringer                   http://www.2ndQuadrant.com/
>>   PostgreSQL Development, 24x7 Support, Training&  Services


-- 
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 (6+ messages)

Message-ID: <53EE2B73.4060308@yahoo.com>
Permalink:  ../53EE2B73.4060308@yahoo.com/
Also on:    postgresql.org/message-id/53EE2B73.4060308@yahoo.com

 · 

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: javadesigner@yahoo.com
  Subject: Re: PreparedStatement error upon trying to set a '?' after interval keyword
  In-Reply-To: <53EE2B73.4060308@yahoo.com>
  References: <53E9144B.4010404@yahoo.com> <CAH7T-apf-tXft3=y91AwnybTNcvcsUtMdP1DAmtbDj+jgwZpJg@mail.gmail.com> <53E991F0.5000109@2ndquadrant.com> <CAH7T-aoPABiZyCqSy6cVDxKRH6KGrWfi-NAVMUSxFSLPNQ=s-A@mail.gmail.com> <53EE2B73.4060308@yahoo.com>

* 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