X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 09503DAAF3 for ; Sun, 6 Nov 2005 11:49:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56046-05 for ; Sun, 6 Nov 2005 15:49:48 +0000 (GMT) X-Greylist: delayed 00:06:40.602473 by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 01CA8D79D9 for ; Sun, 6 Nov 2005 11:49:50 -0400 (AST) Received: (qmail 26487 invoked from network); 6 Nov 2005 15:43:14 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 6 Nov 2005 15:43:14 -0000 In-Reply-To: <436E0CBC.3060507@dineco.com> References: <436E0CBC.3060507@dineco.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9475581B-E5F2-404C-84CC-7D3774B590BF@fastcrypt.com> Cc: List Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: [Pgjdbc-commit] ERROR: syntax error at or near "$1" Date: Sun, 6 Nov 2005 10:43:12 -0500 To: William Harris X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.022 required=5 tests=[AWL=0.022] X-Spam-Score: 0.022 X-Spam-Level: X-Archive-Number: 200511/33 X-Sequence-Number: 14131 I'm forwarding to the pgsql list, this list is only for committers. Dave On 6-Nov-05, at 9:01 AM, William Harris wrote: > Summary: PreparedStatement positional parameters not working as > usefully as in version 7. > > Driver: http://jdbc.postgresql.org/download/ > postgresql-8.0-314.jdbc3.jar > PostgreSQL: 8.0.4 > > We have just migrated our application to version 8.04 of postgresql > (from version 7), but are getting some issues with version 8 > postgresql jdbc driver when using prepared statements. > > Here are some examples of code that used to work pre version 8, > which fails now; > > Ex 1; > setSeqScanStmt = con.prepareStatement( "set enable_seqscan=?" ); > setSeqScanStmt.setString(1,"on"); > ResultSet rs = setSeqScanStmt.executeQuery(); > > Ex 2; > intervalStmt = con.prepareStatement( "select current_date + > (interval ?)" ); > intervalStmt .setString(1,"5 days"); > ResultSet rs = intervalStmt.executeQuery(); > > Both these exmaple throw the; > ERROR: syntax error at or near "$1" > exception > > If the later example can no longer be done it will be a big > drawback in usabilty for this driver! > > > > > > > > java.sql.SQLException: ERROR: syntax error at or near "$1" > at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse > (QueryExecutorImpl.java:1471) > at org.postgresql.core.v3.QueryExecutorImpl.processResults > (QueryExecutorImpl.java:1256) > at org.postgresql.core.v3.QueryExecutorImpl.execute > (QueryExecutorImpl.java:175) > at org.postgresql.jdbc2.AbstractJdbc2Statement.execute > (AbstractJdbc2Statement.java:392) > at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags > (AbstractJdbc2Statement.java:330) > at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery > (AbstractJdbc2Statement.java:240) > > > _______________________________________________ > Pgjdbc-commit mailing list > Pgjdbc-commit@gborg.postgresql.org > http://gborg.postgresql.org/mailman/listinfo/pgjdbc-commit >