Re: [HACKERS] JPA + enum == Exception

From: Tom Dunstan <pgsql(at)tomd(dot)cc>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [HACKERS] JPA + enum == Exception
Date: 2013-07-07 04:09:16
Message-ID: CAPPfruxCkSnOotBWPmio3RTSikCrWnS1Gw8ytJP_s7WMqQEe3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On 5 July 2013 19:27, Dave Cramer <pg(at)fastcrypt(dot)com> wrote:

> I would think setObject should respect stringtype=unspecified. So I would
> be willing to accept this as a solution
>

OK, here's a pull request with a unit test to cover expected behaviour with
different combinations of setObject and setString, for inserts and queries.

https://github.com/pgjdbc/pgjdbc/pull/68

Interestingly, when I first tried this I tried using point as the type to
test rather than an enum (so that I didn't have to create the enum type in
the test), but it would fail when trying to select a row out in a query
like "select * from thetable where p = ?" saying "operator does not exist:
point = unknown". I presume that this due to multiple = operators for the
point type at the db level, so the backend can't decide which type to
create. I guess there's not much that we can do about that - if things are
ambiguous then you need to be more specific, and of course we have a
PGpoint java object anyway.

Cheers

Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sawada Masahiko 2013-07-07 07:19:01 Re: Patch for fail-back without fresh backup
Previous Message Robins Tharakan 2013-07-07 03:49:23 Re: Add regression tests for DISCARD

Browse pgsql-jdbc by date

  From Date Subject
Next Message m_muthukumar 2013-07-07 06:03:29 Fw:
Previous Message Dave Cramer 2013-07-05 09:57:42 Re: [HACKERS] JPA + enum == Exception