pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: tightening up on use of oid 0
Date: Wed, 13 Oct 2004 22:28:55 +1300
Message-ID: <416CF557.2040000@opencloud.com> (raw)
In-Reply-To: <Pine.BSO.4.56.0410121550580.7695@leary.csoft.net>
References: <41660A56.5000107@opencloud.com>
	<4167BC1A.4070809@opencloud.com>
	<Pine.BSO.4.56.0410120027040.9158@leary.csoft.net>
	<416C3E22.9080605@opencloud.com>
	<Pine.BSO.4.56.0410121550580.7695@leary.csoft.net>

Kris Jurka wrote:

> Your approach has the benefit of being 
> fail-fast as adding a new function to the database suddently can't 
> produce an ambiguity for Java code.

Right. The driver cannot guarantee that setNull(i,Types.OTHER) will 
always be able to infer the right type. It seems safer to me to 
completely disallow it than have it sometimes succeed and sometimes fail 
depending on the exact state of the database. It may break older apps, 
but new apps would be more robust.

General question for the list: how much code is out there that performs 
one of these (equivalent) calls?

   PreparedStatement.setObject(i, null);
   PreparedStatement.setObject(i, null, Types.OTHER);
   PreparedStatement.setNull(i, Types.OTHER);

> I don't think it's a common 
> situation to have overloaded functions that get called with non-typed 
> nulls, so I wanted to allow it to work as usual for non-ambiguous 
> cases.

After some experimentation, it's not just overloaded functions that are 
affected.

- "? IS NULL" breaks if the parameter is an untyped NULL (this was the 
original issue -- in an off-list email --that made me look at this area)

- Functions taking 'anyarray' or 'anyelement' don't like untyped NULLs, 
even if they are STRICT (ERROR:  could not determine anyarray/anyelement 
type because input has type "unknown")

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..

-O



view thread (20+ messages)  latest in thread

Message-ID: <416CF557.2040000@opencloud.com>
Permalink:  ../416CF557.2040000@opencloud.com/
Also on:    postgresql.org/message-id/416CF557.2040000@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, books@ejurka.com
  Subject: Re: tightening up on use of oid 0
  In-Reply-To: <416CF557.2040000@opencloud.com>
  References: <41660A56.5000107@opencloud.com> <4167BC1A.4070809@opencloud.com> <Pine.BSO.4.56.0410120027040.9158@leary.csoft.net> <416C3E22.9080605@opencloud.com> <Pine.BSO.4.56.0410121550580.7695@leary.csoft.net> <416CF557.2040000@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox