From: | "David Pinheiro" <davidsantospinheiro(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #6292: java.sql.PreparedStatement.setNull() throws PSQLException |
Date: | 2011-11-14 16:31:02 |
Message-ID: | 201111141631.pAEGV2pt071873@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-jdbc |
The following bug has been logged online:
Bug reference: 6292
Logged by: David Pinheiro
Email address: davidsantospinheiro(at)gmail(dot)com
PostgreSQL version: 8.4
Operating system: Linux
Description: java.sql.PreparedStatement.setNull() throws
PSQLException
Details:
I'm trying to make:
java.sql.PreparedStatement.setNull(1,java.sql.Types.NULL);
But i get:
org.postgresql.util.PSQLException: ERROR: column "number_column" is of type
integer but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
My code is something like:
if (String.valueOf(input_field) == "null"){
statement.setNull(1, java.sql.Types.NULL);
} else {
statement.setObject(1, valor);
}
statement.executeUpdate();
Java says:
org.postgresql.util.PSQLException: ERROR: column "number_column" is of type
integer but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
Position: 159
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorI
mpl.java:2096)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.ja
va:1829)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
ava:510)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2St
atement.java:386)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2State
ment.java:332)
at
pt.cm_olhao.tecidoempresarial.database.estabelecimentos.EstabelecimentosFree
formStatementDelegate.storeRow(EstabelecimentosFreeformStatementDelegate.jav
a:160)
I have Postgresql 8.4 and postgresql-jdbc-8.4-703.
Thanks a lot!
David Pinheiro
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2011-11-14 23:11:23 | Cannot dump 8.4.8 database using later versions |
Previous Message | Daniel Farina | 2011-11-14 06:30:09 | Re: BUG #6291: Xid epoch is not updated properly |
From | Date | Subject | |
---|---|---|---|
Next Message | Teun Hoogendoorn | 2011-11-15 08:59:20 | BUG #6293: JDBC driver performance |
Previous Message | Bruno Harbulot | 2011-11-14 14:23:04 | Re: Support for cert auth in JDBC |