[Pljava-dev] uuid datatypes and prepared statements

From: lucas at mcsnw(dot)com (Lucas Madar)
To:
Subject: [Pljava-dev] uuid datatypes and prepared statements
Date: 2009-06-24 06:49:41
Message-ID: 4A41CC85.6060708@mcsnw.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

I found a workaround, but I'm not sure if there are any bad side effects
to doing it this way: (other than it being ugly)

Before I do any queries with Java UUIDs, I do:
Oid.registerType(UUID.class, new Oid(2950));
(2950 is the 'magic number' OID from postgresql's types.h)

This seems to have the effect of letting JDBC map Java native UUIDs to
Postgresql UUIDs.

- Lucas

On 6/23/2009 8:00 PM, Lucas Madar wrote:
> I'm running into a weird error when using prepared statements within
> pl/java:
>
> ERROR: operator does not exist: uuid = text
>
> This is from a very basic query of "SELECT xxx FROM table WHERE
> uuid=?". The table's column type is uuid and the java native type is
> String. It works fine via plain JDBC and also works via pl/java if I
> use a ::uuid after the query. However, this makes maintaining these
> queries a mess. I'm running postgres 8.3.7.
>
> Has anyone else experienced this?
>

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Kris Jurka 2009-06-24 18:44:17 [Pljava-dev] uuid datatypes and prepared statements
Previous Message Lucas Madar 2009-06-24 03:00:44 [Pljava-dev] uuid datatypes and prepared statements