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 D031D32A773 for ; Thu, 14 Oct 2004 00:13:50 +0100 (BST) 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 68029-08 for ; Wed, 13 Oct 2004 23:13:39 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id AB12032BCF3 for ; Thu, 14 Oct 2004 00:13:40 +0100 (BST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CHsJP-0007Tw-00; Thu, 14 Oct 2004 12:13:39 +1300 Message-ID: <416DB6A1.4030808@opencloud.com> Date: Thu, 14 Oct 2004 12:13:37 +1300 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kris Jurka Cc: "pgsql-jdbc@postgresql.org" Subject: Re: tightening up on use of oid 0 References: <41660A56.5000107@opencloud.com> <4167BC1A.4070809@opencloud.com> <416C3E22.9080605@opencloud.com> <416CF557.2040000@opencloud.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/129 X-Sequence-Number: 11234 Kris Jurka wrote: > > On Wed, 13 Oct 2004, Oliver Jowett wrote: > > >>I'd like to catch those errors earlier than query execution if possible. >>If nothing else, it'll encourage application developers to provide >>correct type info to the driver in all cases.. > > > I don't see the real benefit of catching this one statement earlier. It's > still a runtime failure. My point was that it is useful to generate an error on *all* uses of untyped nulls, so that the developer sees the error in all cases regardless of the database state or statement context. Consider, for example, framework code that calls user-specified or user-provided functions. If it uses untyped nulls, and the driver uses Oid.UNKNOWN, you will only see the problem when the framework tries to pass a NULL to an overloaded function. If the driver rejects the call with an error in all cases where a NULL is used, then the framework developer sees the error as soon as they exercise the NULL path, regardless of whether their test environment has overloaded functions or not. ==== The spec has this to say about the setObject case: >> If setObject is called without a type parameter, the Java Object is >> implicitly mapped using the default mapping for that object type. There is no default mapping (in appendix B table B-4) for Java nulls. Of course the spec then goes on to say: >> If a Java null is passed to any of the setter methods that take a Java >> object, the parameter will be set to JDBC NULL. I don't know which takes precedence. The way that setNull() is organized implies that JDBC requires NULLs to be typed, but there's nothing explicit about it. -O