Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id ECD641337B54 for ; Mon, 7 Feb 2011 17:38:51 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 92728-10 for ; Mon, 7 Feb 2011 21:38:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.softperience.eu (static-ip-217-118-26-141.inaddr.intergenia.de [217.118.26.141]) by mail.postgresql.org (Postfix) with ESMTP id 447BD1336971 for ; Mon, 7 Feb 2011 17:38:43 -0400 (AST) Received: from radek.localnet (87-204-194-135.dg-net.pl [87.204.194.135]) by mail.softperience.eu (Postfix) with ESMTPA id ABFB8C000CD; Mon, 7 Feb 2011 22:38:42 +0100 (CET) From: =?utf-8?q?Rados=C5=82aw_Smogura?= To: pgsql-jdbc@postgresql.org Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob Date: Mon, 7 Feb 2011 22:38:42 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.36-gentoo-r5; KDE/4.4.5; x86_64; ; ) Cc: Andreas Joseph Krogh References: <201102070001.22259.andreak@officenet.no> <201102070911.20245.rsmogura@softperience.eu> <4D505B02.804@officenet.no> In-Reply-To: <4D505B02.804@officenet.no> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201102072238.42274.rsmogura@softperience.eu> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/36 X-Sequence-Number: 21434 PostgreSQL doesn't have field type CLOB, nor BLOB.=20 If eveny it would be possible for driver to read CLOB from varchar, driver= =20 will be unable to set proper value when calling UPDATE or INSTERT. It is du= e=20 to internal way how PSQL deals with those values. I know drivers supports custom casting, but casting from varchar to clob is= =20 implicite prohibted in JDBC. If you look at B-6 table x indicates possible= =20 casting. There is no x, nor X on varchar cross clob Kind regards, Rados=C5=82aw Smogura Andreas Joseph Krogh Monday 07 February 2011 21:50:10 > On 02/07/2011 09:11 AM, Rados=C5=82aw Smogura wrote: > > Hi, > > PGSQL doesn't have CLOB type, instead JDBC uses LOB, but PGSQL doesn't >=20 > have >=20 > > "clear" lob field type. It uses in table column with type OID, and >=20 > supporting >=20 > > table for storing large objects. > >=20 > > Look at bug submited by me > > http://opensource.atlassian.com/projects/hibernate/browse/HHH-4617 > > Should be fixed in 3.6.1 release. >=20 > I'm experiencing this with 3.6.1 so whatever that issue fixes, > MaterializedClobType (which is the default type Hibernate uses when it > sees @Lob on String-types) still uses ClobTypeDescriptor, which again > has this code: >=20 > protected X doExtract(ResultSet rs, String name, WrapperOptions options) > throws SQLException { > return javaTypeDescriptor.wrap( rs.getClob( name ), options ); > } >=20 > And it should be able to call rs.getClob(). >=20 > It's not clear to me why the JDBC-driver for PG shouldn't just use > rs.getString() internally for getClob() calls? Requiring > special-handling in Hibernate for dealing with Strings by setting an > obscure property just doesn't seem right. And I don't want to set a > property to handle CLOB which might affect how I use BLOBs.