X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A23035298A for ; Tue, 19 Jul 2005 11:34:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44660-06 for ; Tue, 19 Jul 2005 14:34:20 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 02DC252869 for ; Tue, 19 Jul 2005 11:34:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JEYBik023730; Tue, 19 Jul 2005 10:34:11 -0400 (EDT) To: Oliver Jowett Cc: Dave Cramer , Christian Cryder , pgsql-jdbc@postgresql.org Subject: Re: Timestamp Conversion Woes Redux In-reply-to: <42DD0824.9060002@opencloud.com> References: <90876a9e05071810503606d431@mail.gmail.com> <16335.1121714809@sss.pgh.pa.us> <10C90079-DD0A-43D7-9389-7486803F0AB1@fastcrypt.com> <42DC37AC.5030704@opencloud.com> <42DCF0C9.4030501@opencloud.com> <23396.1121781259@sss.pgh.pa.us> <42DD0824.9060002@opencloud.com> Comments: In-reply-to Oliver Jowett message dated "Tue, 19 Jul 2005 14:03:16 -0000" Date: Tue, 19 Jul 2005 10:34:11 -0400 Message-ID: <23729.1121783651@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/134 X-Sequence-Number: 13282 Oliver Jowett writes: > The main thing I'm worried about there is that if there are cases where > an UNKNOWN parameter will generate an error rather than resolve to TEXT, > then the driver has just backed the user into a corner they can't escape > from. Are there any cases where this can happen? There are some, for instance someone was just complaining about this: template1=# select 1 where 5 in (select ''); ERROR: failed to find conversion function from "unknown" to integer My previous response was based on what was in my inbox, which I now see wasn't the whole thread. I agree with you that if we make setString default to UNKNOWN, there had better be a way to say "by golly this really is TEXT" for the corner cases. It'd be a good idea if it wasn't limited to TEXT, either, but could allow specification of any random datatype. I believe that UNKNOWN will work fine for 99% of cases out there, because the backend's algorithms have been tuned for years to generally do the right thing when presented with unadorned literal strings --- but there has to be an escape hatch for the other 1%. Of course, there's always the escape hatch of changing the query text, that is write select ... cast(? as text) or select ... ?::text but this seems pretty crude. regards, tom lane