From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Kris Jurka <books(at)ejurka(dot)com> |
Cc: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: tightening up on use of oid 0 |
Date: | 2004-10-13 09:28:55 |
Message-ID: | 416CF557.2040000@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Iain | 2004-10-13 10:53:41 | Re: tightening up on use of oid 0 |
Previous Message | Oliver Jowett | 2004-10-13 05:58:10 | Re: tightening up on use of oid 0 |