|
Home > Archive > PostgreSQL JDBC > December 2005 > 8.2dev-500.jdbc3 driver: PreparedStatement.toString() is buggy
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
8.2dev-500.jdbc3 driver: PreparedStatement.toString() is buggy
|
|
| j.random.programmer 2005-12-19, 1:24 pm |
| Hi:
There seems to be a bug with the 8.2dev-500
driver, running against a postgres 8.1 database.
If I have a PreparedStatement, then when I say:
System.out.println(ps)
the the prepared statement that is printed is
*missing* single quotes around data/time AND
character/string values. This means that I
cannot copy that preparedstatment and paste
it directly into a psql session etc.
For example, this is what a ps.toString() looks like:
--------------------------------------
INSERT into alltypes (smallint_val, int_val,
bigint_val, float_val, double_val, numeric_val,
char_val, varchar_val, timestamp_val, bit_val,
varbinary_val) values (5, 6, 7000, 3.14, 3.141, 11.32,
foo2, bar2, 2005-12-19 09:55:23.464000 -0500, 1,
<stream of 5 bytes> )
-------------------------------------
Note, this is not valid sql since no quotes around
'foo2', 'bar2', '2005...' etc (which are
respectively char and date types).
This is definitely a regression, this did not happen
with earlier drivers.
Best regards,
--j
____________________
____________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
| |
| j.random.programmer 2005-12-20, 3:24 am |
| Oliver:
> I don't think the driver or the spec has ever
> claimed that toString()
> gives you a valid SQL statement.
True :-)
However, note that it *used* to do so. This is a
regression from the past driver. And it would
be nice to have anyway, won't it ?
Also note in the past, booleans would get
converted to '1' and stored in BIT columns.
With the latest driver, java booleans are sent as
the number 1 (no quotes) and thus cannot be
stored in a BIT column, in direct contradiction to
the JDBC spec. (that's a different issue, see my
other post but I have a feeling it may somehow
be related).
Best regards,
--j
____________________
____________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
|
|
|
|
|