Re: Bug: Cannot pass null in Parameter in Query for ISNULL

From: Maciek Sakrejda <msakrejda(at)truviso(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: bht(at)actrix(dot)gen(dot)nz, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug: Cannot pass null in Parameter in Query for ISNULL
Date: 2011-12-01 19:41:10
Message-ID: CAH_hXRY2UEBZFAEHGohxz7OKLiwY5QxC2HbRPECsO4hM4cptNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

>> I hope you are not suggesting that I
>> discuss this with PostgreSQL DB engine engineers. I really can't do
>> that so I will keep requesting a fix here.
>
> Actually, that was exactly what I was suggesting. As I described in my
> previous mail, it's really not something that can be handled in the
> driver. You want a change to how parameters of unknown type are
> handled in IS NULL expressions; that's entirely server-side, the
> driver has no idea what an IS NULL expression looks like. You'll
> probably want a stronger argument than "our JPA implementation doesn't
> pass type information" first though.

Actually, since this is the root of the problem, I'd be curious as to
how all the other major drivers/DBs handle this if they work as
claimed. The other drivers must either inline the values into the SQL
(i.e., the driver takes care of parameterization) which side-steps
this problem (trading it for others), have server-side support for
this (I'd be surprised if this is widely supported since it's not a
trivial feature and not that broadly useful), or work some unexpected
magic in the driver (though I'm rather skeptical that something is
feasible there). If you're serious about this, a good way to continue
this discussion would be to illustrate how this works in other
implementations of the spec.

I guess one possible way to do this would be to only inline null
values when binding parameters, although that seems on the dangerous
side of clever (and you'd have a hell of a time getting it to work
with named prepared statements).
---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2011-12-02 00:21:41 Re: Bug: Cannot pass null in Parameter in Query for ISNULL
Previous Message Craig Ringer 2011-12-01 13:39:45 Re: Bug: Cannot pass null in Parameter in Query for ISNULL