Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 2FA189FA4BB for ; Mon, 26 Mar 2007 05:05:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 89036-08 for ; Mon, 26 Mar 2007 05:05:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from eppesuigoccas.homedns.org (host245-172-dynamic.0-87-r.retail.telecomitalia.it [87.0.172.245]) by postgresql.org (Postfix) with ESMTP id BFB8F9FA4B4 for ; Mon, 26 Mar 2007 05:05:26 -0300 (ADT) Received: from eppesuig3wifi ([192.168.2.51] helo=scarafaggio) by eppesuigoccas.homedns.org with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1HVk6Q-0003pI-Vw; Mon, 26 Mar 2007 09:58:55 +0200 Received: from giuseppe by scarafaggio with local (Exim 4.63) (envelope-from ) id 1HVkDH-0005Dz-Tr; Mon, 26 Mar 2007 10:06:00 +0200 Subject: Re: Problem with string parameters From: Giuseppe Sacco To: RichT Cc: pgsql-jdbc@postgresql.org In-Reply-To: <1174764946.377183.140290@y80g2000hsf.googlegroups.com> References: <1174764946.377183.140290@y80g2000hsf.googlegroups.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Lixper S.r.L. Date: Mon, 26 Mar 2007 10:05:59 +0200 Message-Id: <1174896359.2114.10.camel@scarafaggio> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.712 tagged_above=0 required=5 tests=AWL, BAYES_20, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL X-Spam-Level: * X-Archive-Number: 200703/118 X-Sequence-Number: 16832 Il giorno sab, 24/03/2007 alle 12.35 -0700, RichT ha scritto: > Can anyone help with this? > > I am using Postgres 7.4.13 JDBC interface and I get > "PSQLException: Parameter index out of range." > > The query is: > INSERT INTO shm_log_sources > SELECT ? as name, ci.source_id, true as active, true as monitor, > 0 as alerts_sent, '' as comment > FROM shm_current_ids ci LEFT OUTER JOIN shm_log_sources ls > ON ci.source_id = ls.source_id AND ls.name = ? > WHERE ls.active IS NULL [...] I think you may only bind variable in the WHERE clause. You cannot bud variable in the SELECT part. Bye, Giuseppe