From: | Barry Lind <barry(at)xythos(dot)com> |
---|---|
To: | "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: JDBC patch (attempt#2) for util.Serialize and jdbc2.PreparedStatement |
Date: | 2001-09-05 19:11:06 |
Message-ID: | 3B9678CA.5050509@xythos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-patches |
Robert,
Thanks for the patch. While I didn't review it too closely, what I saw
seemed fine.
However, I have concerns about the feature as a whole, which really has
nothing to do with your patch.
I don't like the approach taken here for serialization. It seems to me
that this is a half baked attempt to reimplement native java
serialization. Why not just use java serialization to do what it was
intended for? We could then store the results of the serialization in a
bytea column, or a LargeObject, or even in a separate table as is done
here. However, I am unsure of the desireabilty of creating these
additional tables. The bigest reason I don't like the additional tables
is that the serialized objects don't ever get deleted.
To the extent that this is documented, I think the feature should be
marked as experimental with a caution that it may be changed in major
non-backwardly compatible ways in the future.
thanks,
--Barry
Robert B. Easter wrote:
> (attempt #2) Don't use serializepatch.tgz that I sent before, use the file
> attached now to this email instead.
>
> The attached file: SerializePatch2.tgz, contains a patch for
> org.postgresql.util.Serialize and org.postgresql.jdbc2.PreparedStatement that
> fixes the ability to "serialize" a simple java class into a postgres table.
>
> The current cvs seems completely broken in this support, so the patch puts it
> into working condition, granted that there are many limitations with
> serializing java classes into Postgres.
>
> A little test program is included with the patches. The comments in the
> Serialize class tries to explain how all this works.
>
> Note:
> The code to do serialize appears to have been in the driver since Postgres
> 6.4, according to some comments in the source. My code is not adding any
> totally new ability to the driver, rather just fixing what is there so that
> it actually is usable. I do not think that it should affect any existing
> functions of the driver that people regularly depend on.
>
> The code is activated if you use jdbc2.PreparedStatement and try to setObject
> some java class type that is unrecognized, like not String or not some other
> primitive type. This will cause a sequence of function calls that results in
> an instance of Serialize being instantiated for the class type passed. The
> Serialize constructor will query pg_class to see if it can find an existing
> table that matches the name of the java class. If found, it will continue and
> try to use the table to store the object, otherwise an SQL exception is
> thrown and no harm is done. Serialize.create() has to be used to setup the
> table for a java class before anything can really happen with this code other
> than an SQLException (unless by some freak chance a table exists that it
> thinks it can use).
>
> I saw a difference in Serialize.java between 7.1.3 and 7.2devel that I didn't
> notice before, so I had to redo my changes from the 7.2devel version (why I
> had to resend this patch now). I was missing the fixString stuff, which is
> nice and is imporant to ensure the inserts will not fail due to embedded
> single quote or unescaped backslashes. I changed that fixString function in
> Serialize just a little since there is no need to muddle with escaping
> newlines: only escaping single quote and literal backslashes is needed.
> Postgres appears to insert newlines within strings without trouble.
>
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
> SerializePatch2.tgz
>
> Content-Type:
>
> application/x-gzip
> Content-Encoding:
>
> base64
>
>
> ------------------------------------------------------------------------
> Part 1.3
>
> Content-Type:
>
> text/plain
> Content-Encoding:
>
> binary
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Pothier | 2001-09-05 19:45:16 | parse error: LIMIT combined with UNION |
Previous Message | Bruce Momjian | 2001-09-05 16:56:20 | Re: BUG(fixed) in CREATE TABLE ADD CONSTRAINT... |
From | Date | Subject | |
---|---|---|---|
Next Message | Joseph Shraibman | 2001-09-05 19:41:19 | Re: Patch for jdbc2 ResultSet.java |
Previous Message | Barry Lind | 2001-09-05 18:42:23 | Re: Read transactions don't work on 7.0.x db's 2nd patch |