From: Craig Ringer <ringerc@ringerc.id.au>
To: Thor Michael Støre <thormichael@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ResultSetMetaData.isNullable(i) and outer joined columns
Date: Fri, 12 Oct 2012 09:21:03 +0800
Message-ID: <5077707F.6090502@ringerc.id.au> (raw)
In-Reply-To: <63DBC81F-2AB0-4C02-AC08-2B05C31FFCA6@gmail.com>
References: <63DBC81F-2AB0-4C02-AC08-2B05C31FFCA6@gmail.com>
On 10/12/2012 01:25 AM, Thor Michael Støre wrote:
> Hello,
>
> I've just noticed that ResultSetMetaData.isNullable(/i/) in the
> PostgreSQL JDBC driver doesn't reflect whether fields of result set
> column /i/ may be null, but the nullability of the table column it's
> selected from. These may differ for result set columns that originate
> from a outer joined table, in which case fields may of course be null
> even if the source table column is not nullable, but in such cases
> isNullable still indicates the column is not nullable. Surely this
> isn't right?
>
> http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSetMetaData.html#isNullable(int)
> <http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSetMetaData.html#isNullable%28int%29;
>
> Although the spec doesn't explicitly distinguish between result set
> and source table only the former seems sensible to me -- what I expect
> the isNullable return value to reflect is whether an invocation of the
> ResultSet.getXXX(/i/) methods always returns an object (or sensible
> primitive), if they may return null or if that's unknown.
It'll be interesting to see how other major vendors' drivers handle this.
Thanks for the test case; I'll try to find some other DBs to run it on.
--
Craig Ringer
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: ringerc@ringerc.id.au, thormichael@gmail.com
Subject: Re: ResultSetMetaData.isNullable(i) and outer joined columns
In-Reply-To: <5077707F.6090502@ringerc.id.au>
References: <63DBC81F-2AB0-4C02-AC08-2B05C31FFCA6@gmail.com> <5077707F.6090502@ringerc.id.au>
* 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