Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id B7257AF82EA; Mon, 9 Jan 2012 13:58:01 -0400 (AST) Received: from static-ip-217-118-26-141.inaddr.ip-pool.com ([217.118.26.141] helo=mail.softperience.eu) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RkJTo-0002Qw-9U; Mon, 09 Jan 2012 17:58:02 +0000 Received: from localhost.localnet (ced133.neoplus.adsl.tpnet.pl [83.30.179.133]) by mail.softperience.eu (Postfix) with ESMTPA id 9E6EEC00032; Mon, 9 Jan 2012 18:57:42 +0100 (CET) From: =?utf-8?B?UmFkb3PFgmF3?= Smogura To: Alban Hertroys Cc: Stefan Keller , pgsql-general List , pgsql-jdbc@postgresql.org Subject: Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues Date: Mon, 09 Jan 2012 18:57:39 +0100 Message-ID: <1472223.7TltgQ0Nt7@localhost> User-Agent: KMail/4.7.3 (Linux/3.0.6-gentoo; KDE/4.7.3; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/189 X-Sequence-Number: 183841 Dnia poniedzia=C5=82ek, 9 stycznia 2012 o 15:52:23 Alban Hertroys napis= a=C5=82(a): > On 9 January 2012 14:55, Rados=C5=82aw Smogura wrote: > > So responsible for this is database, but database doesn't have > > "real" BLOBs, this what is made in PG JDBC driver is just "not perf= ect" > > way to add this functionality to PostgreSQL. >=20 > I think you should elaborate on what you mean when you say that > Postgres doesn't have "real" BLOBs. >=20 > This discussion did make me wonder about something in Postgres' > LOB-support though. As explained earlier, the current implementation > allows for dedubbing LOB's, so that it's not necessary to store the > same large(!) object multiple times. That is also what's causing this= > issue with the JDBC driver, or perhaps Hybernate in particular. >=20 > However, shouldn't it be up to the application designer to dedup larg= e > objects or not? >=20 > The current implementation is probably rather convenient for projects= > where duplicate large objects are common, but - as it turns out - it > can be quite inconvenient when that's opposite to expectations. >=20 > ISTMT this behaviour should at least be optional. Of course that > raises the question what should happen with an existing set of LOB's > when that setting gets changed. In real world BLOBs are transfered as references, and those references = are=20 managed in way as the trigger does. Nacked PG doesn't support deletion,= Oid is=20 universal type so it can't be used by GC approach, unles collector will= know=20 which Oid is LOB oid. Oid is like void*, it's abstarct pointer. If you get void* you don't kn= ow if=20 data referenced by it represent person row, or car row, you don't know = if=20 void* is even reference or just 64 bit number. Current implementation i= s not=20 type safe. You can't just write UPDATE TABLE x SET blob =3D 'aadfasfasf= da' which=20 in current times should be supported, but you may write (if are not ful= ly=20 familiar with db) UPDATE table X set varchar_d =3D blob_column; In fact LOB's id may be stored even as varchar. So true is that PG supp= orts=20 LOBs, but due to missing functionality LOBs are quite hard to manage. I= t's=20 like car withot steering wheel - you may drive, but it's little bit har= d. Regards, Radek