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 D95475298A for ; Tue, 19 Jul 2005 11:47:05 -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 48673-01 for ; Tue, 19 Jul 2005 14:47:03 +0000 (GMT) Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by svr1.postgresql.org (Postfix) with ESMTP id 1C62152989 for ; Tue, 19 Jul 2005 11:46:59 -0300 (ADT) Received: from [192.168.1.110] (unknown [192.168.1.110]) by mail.ecircle.de (READY) with ESMTP id 37BC311CB64; Tue, 19 Jul 2005 16:47:02 +0200 (CEST) Subject: Re: Timestamp Conversion Woes Redux From: Csaba Nagy To: Oliver Jowett Cc: Tom Lane , Dave Cramer , Christian Cryder , Postgres JDBC 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> Content-Type: text/plain Message-Id: <1121784422.3085.288.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 19 Jul 2005 16:47:02 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/135 X-Sequence-Number: 13283 Hi all, My opinion as a user who just "fixed" his application to properly set the data base types: fixing the application is a bigger PITA than fixing weird cases of strange type choices of the server. The first one involves changing lots of exiting code, the second involves newly written code, as I think the old code relying on setting string and letting the server decide what is it should work fine. In my case I've had to make extra meta data look-ups to be able to properly set the data type in some of our more generic code, which is adding some complexity overhead to my code (I presume the performance difference is negligible). Given the fact that the server is very likely to decide correctly the type, and a lot of code can be simpler if no exact knowledge of the data types is needed, I think setting the type to unknown should be acceptable. Actually, will this allow to use setString on a boolean field using preaparedStatements ? 'cause that's the one which gave me the headaches. Just my 2c. Cheers, Csaba. On Tue, 2005-07-19 at 16:03, Oliver Jowett wrote: > Tom Lane wrote: > > > I think one main point against using UNKNOWN is that it creates a risk > > of "could not resolve parameter type" query failures. That's OK for > > generic setString() cases, since the user can always escape the failure > > by changing his code to specify the parameter type more clearly. > > > The other argument against UNKNOWN is that the backend might choose an > > unexpected data type. Again, that doesn't scare me a lot for setString, > > because the backend's rules for dealing with UNKNOWN are biased in favor > > of resolving the parameter type as TEXT, which seems perfectly > > reasonable for setString cases. > > 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? (I'm thinking of some > of the ambiguous-type problems we ran into when sending nulls as UNKNOWN..) > > -O > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend