jdbc and automagic casting

From: Guillaume <lomig42(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: jdbc and automagic casting
Date: 2011-09-19 14:39:38
Message-ID: 419cf418-a33a-4c61-858c-208bf5d55844@g30g2000yqc.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I have an INSERT which does not behave the same under jdbc and psql.

With psql, INSERTing a poperly formed VARCHAR into an inet column
would work, eg.:

=# \d user_record;
Table "user_record"
Column | Type | Modifiers
----------------------+------------------------+-----------
id | integer |
username | character varying(64) |
registered_ip | inet |

INSERT INTO user_record (0, 'abc', '127.0.0.1') is valid and works.
The string is automagically casted as an inet value.

Using jdbc, this is not the case, and causes me loads of trouble (and
exceptions).
Is there a way around it?

I do not have access to the java source code, there is thus no way to
update the code to programatically force a CAST.

Thanks for any help,
Guillaume

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2011-09-19 14:47:12 Re: binary patch problems
Previous Message Bodor Andras 2011-09-19 14:38:47 Re: binary patch problems