Re: [HACKERS] JPA + enum == Exception

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] JPA + enum == Exception
Дата
Msg-id 22027.1360684244@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] JPA + enum == Exception  (Craig Ringer <craig@2ndquadrant.com>)
Ответы Re: [HACKERS] JPA + enum == Exception  (Craig Ringer <craig@2ndquadrant.com>)
Список pgsql-jdbc
Craig Ringer <craig@2ndquadrant.com> writes:
> On 02/08/2013 12:55 PM, Tom Lane wrote:
>> AFAIK this is just business as usual with JDBC: setString() implies that
>> the parameter is of a string type.

> Well, it means that it's a type compatible with a java.lang.String .
> JDBC doesn't say much about the database-side type.

> It's my strong view that we should accept setString(...) for any
> string-like type, like xml, json, domains of text, and so on - or at
> least provide an easy, no-superuser-required way to tell Pg to do so.

The difficulty I've got with that is that there are only two kinds of
literal in SQL, namely numbers and strings, so that "it looks like a
string" applies to absolutely every non-numeric type.  If we go down
this road we'll end up allowing implicit casts from text to (at least)
every non-numeric type, which will be pretty much fatal for type
checking purposes.

IIRC, there's already a hack to tell the JDBC driver to mark setString
parameters as "unknown" rather than "text", which seems to me to be
a much less dangerous way of getting the lenient behavior when you want
it.

            regards, tom lane


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Andreas Reichel
Дата:
Сообщение: Re: Timestamp vs. Java Date/Timestamp
Следующее
От: Bryan Varner
Дата:
Сообщение: Re: PostgreSQL XAResource & GlassFish 3.1.2.2