From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Ingolf Knopf <iknopf(at)csc-dd(dot)de> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #1561: wrong detection of number of parameters in |
Date: | 2005-03-27 05:54:16 |
Message-ID: | 42464A88.3080103@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Ingolf Knopf wrote:
> "java.sql.PreparedStatement.executeUpdate()" throws "java.sql.SQLException",
> if the prepared sql-string contains '?' within a C-like comment.
>
> Example:
> select relname
> from pg_class
> where /*relowner = ? and*/
> relname = ?
>
> In this case, the java.sql.PreparedStatement of PostgreSQL requires two
> parameters, but I have only one.
The JDBC driver doesn't currently parse the statement in much detail. It
really only understands string literals, semicolon-separated statements,
and some JDBC-specified {...} escapes.
A workaround would be to "quote" the comment:
select relname from pg_class where /*" relowner = ? and "*/ relname = ?
which should work (although I have not tested it)
There's no real reason why the driver can't be modified to understand
C-style comments, someone just needs to find the time to do it..
(patches to pgsql-jdbc please ;-)
-O
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Creager | 2005-03-27 06:00:53 | Re: BUG #1563: wrong week returnded by date_trunc('week', |
Previous Message | Olivier Thauvin | 2005-03-27 02:29:02 | BUG #1567: can't hide password with pg_autovacuum |