Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5I8C-0004hy-EB for pgsql-jdbc@arkaria.postgresql.org; Tue, 12 Feb 2013 15:50:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U5I8B-0000p8-S8 for pgsql-jdbc@arkaria.postgresql.org; Tue, 12 Feb 2013 15:50:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5I8A-0000oO-Qz for pgsql-jdbc@postgresql.org; Tue, 12 Feb 2013 15:50:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5I87-0008Bb-KQ for pgsql-jdbc@postgresql.org; Tue, 12 Feb 2013 15:50:50 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r1CFojt8022028; Tue, 12 Feb 2013 10:50:45 -0500 (EST) From: Tom Lane To: Craig Ringer cc: Tom Dunstan , "Hudson, Derrick" , "Marc G. Fournier" , "pgsql-jdbc@postgresql.org" , pgsql-hackers@postgresql.org Subject: Re: [HACKERS] JPA + enum == Exception In-reply-to: <5119F0F7.2030204@2ndquadrant.com> References: <401084E5E73F4241A44F3C9E6FD794289CE24D03@exch-01> <28690.1360299322@sss.pgh.pa.us> <5119F0F7.2030204@2ndquadrant.com> Comments: In-reply-to Craig Ringer message dated "Tue, 12 Feb 2013 15:36:23 +0800" Date: Tue, 12 Feb 2013 10:50:44 -0500 Message-ID: <22027.1360684244@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Craig Ringer 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 -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc