Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XGuvu-0000s7-Lz for pgsql-jdbc@arkaria.postgresql.org; Mon, 11 Aug 2014 19:07:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XGuvt-0002sk-RF for pgsql-jdbc@arkaria.postgresql.org; Mon, 11 Aug 2014 19:07:01 +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 1XGuvt-0002s8-3X for pgsql-jdbc@postgresql.org; Mon, 11 Aug 2014 19:07:01 +0000 Received: from nm45-vm3.bullet.mail.bf1.yahoo.com ([216.109.115.62]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XGuvo-0001Ev-K3 for pgsql-jdbc@postgresql.org; Mon, 11 Aug 2014 19:06:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1407784015; bh=kKHJYZwuDnVMX8iR6s2rn27KBSAYHsuSIWgs53htf1U=; h=Received:Received:Received:DKIM-Signature:X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=phoqIWS1+EkCaS1crJjmj0h5jt+OgiXwVh5gOVtxt5B8oQ6IkbaGPPD3P5tLj3tj+FCSMDvcnRQeLxJw4YOWMxDZcFEnRMht9S9mrqA+DSXfRLnBq/Mp0v5GarG0CZIeb8mHxxpMmIFYY7N1RK4hlq01zOP1MMeND3ViyvrNuihh2Lf5EEPTJrhR/Ef0GxE/Lk2Tl14eJS389l1t2ym1N4XRc9ztGzs8PsM/zBbMlPKQ0MW2/HLxu0Ac4HfVl+evfoJfB6i5J68VLz3rlYHRHk0AW9sSGuDzZ2h2vAICtVRPZ1faSYxFGgbRGdmnLkH4bxTASeqeVP+jIvlhQS0KHQ== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=IVelZjP18STNPzYcKVbXxljGbpx6d6ymDhaIFTXbai4cDCq5+3YaFECWXr0Tt2nfzkDSQs92+reH8ZKnfUzRy9FjdsYC/pZfQWgJ3jvLDVE8u6xy5Qh8cRKyCURcxhq3wosziGKIsmmH9d6AkO0Y8MlqwPtHo4qMdhdi6kZMbe9OoQ9+uCwK54SD2W+5JJG1ccPlbAuHTMA4WOYjhExrGO2JUcCp6wkLq6UnlOABGoW1Hp1RVVobKIuK7NSXMmhZEsUgy0KIE+rP0gUjAphZJjYQ12t3q8cDcN5KkHAhXDKBDPyItflpWtCo0VXbn/5SfCmd0/WuuC+AnniokdnnhA==; Received: from [98.139.215.142] by nm45.bullet.mail.bf1.yahoo.com with NNFMP; 11 Aug 2014 19:06:55 -0000 Received: from [98.139.213.8] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 11 Aug 2014 19:06:54 -0000 Received: from [127.0.0.1] by smtp108.mail.bf1.yahoo.com with NNFMP; 11 Aug 2014 19:06:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1407784014; bh=kKHJYZwuDnVMX8iR6s2rn27KBSAYHsuSIWgs53htf1U=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=g52F+JAMNb5cTdszPTnCKve4d6iusrK7qgPLSJHVWYrjtAYSyDcsuIEHDCO3jTHdbRnrcDVcpvGN326QiotpfkLDsT/EiuAEZcyjMLfchQcEi3lq41oowIt3UyHmk5a6J+jH8r7Vj/rcCl0kAOBOU0LqP+ZAViz6CcNsIPfXO38= X-Yahoo-Newman-Id: 742631.27629.bm@smtp108.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: H39sS4sVM1nigX9xRMICDIUbYiFLzPhpcX4u.jfmPgiEpmR E6nhoUAbGyJ0XxXGSt11NUyNgajpagV1N5xlUd9xbcQ.muE6Cv5yI1R6WKdg PvuQjeSqFop1jEVffs0Vz3G3xyg6G3XtwYlNgX_nGZHt0iI.gel1BM0psBxn cRZ2M_WxFp56kdxeyYim3I2YYcgzczpQE.0CdPNE2TiyNnMXXrwmhDsiQLNW uOEW2O7n_MbCOo9tNt3zmbYUX_qFhLcZFu_SfJ9j60XKgJ6ngoA3UtKGl3ib 3iBFqJ8MOdoXFulq7pD37m4y2bc.Fd1RYk.casi_24DAnMNrb8VDrbbnL0F2 .IsC2W5Pgif0CbW2dUtg3z1kaG0V2teuVRCJV7gl63scf0oz5C2XWMzWIcYQ I1hxBCRuuCOpaL1lWjBRAPTmv3fKh8wZWG60dBAuey3_flrLdJM_pqX.FY4W XG_SjsUMPzkncZRmFyi0GjEWHpw1I6V2_SHOzIRZiMN.xgbdBIfaI8d2KP4U oEuviosuErAF1YjRctMJmOgRdcg-- X-Yahoo-SMTP: wP6k2dGswBDEh9ARhIMn.Am7qbwvtMXTlQ-- Message-ID: <53E9144B.4010404@yahoo.com> Date: Mon, 11 Aug 2014 15:06:51 -0400 From: javadesigner User-Agent: Postbox 3.0.11 (Macintosh/20140602) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: PreparedStatement error upon trying to set a '?' after interval keyword Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) 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 Hi: postgres: 9.3.4 driver: postgresql-9.3-1102.jdbc4.jar I have the following query: select count(*) from checkin where pid = ? and checkin_time > current_date - interval '? days' When I try to set the interval (parameter 2, second question mark): ps.setLong("pid", 123); ps.setInt("interval_days", 7); I get the following error: ERROR org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1 at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:56) ===== I looked at the mailing list archives and whereas others have seen the same issue, I am trying to understand the root cause of why the JDBC driver throws an error here ? Should it just set the location of the second question mark, with the specified data type (in this case in integer) ? What's the point of throwing an error, why does the preparedstatement care ? Its job is to simply replace question marks with the specified data type, right ? Best --j ` -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc