Re: BUG #14853: Parameter type is required even when the query does not need to know the type

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Eduardo Pérez Ureta <edpeur(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14853: Parameter type is required even when the query does not need to know the type
Date: 2017-10-16 15:39:33
Message-ID: CAKFQuwY2ce_MPA1NfURTy_O-XY6whj9eODPu6FA5r_k0q9dSKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Oct 16, 2017 at 8:24 AM, Eduardo Pérez Ureta <edpeur(at)gmail(dot)com>
wrote:

> I have an application that I am trying to make it work in PostgreSQL and
> PostgreSQL seems to be the only database that does not support queries like:
> SELECT 1 WHERE ? IS NULL
> with a Java setTimestamp parameter.
>
> You say PostgreSQL is strongly typed, but an unknown type is accepted in
> the cases I presented before. Do you mean that PostgreSQL is not following
> the SQL standard?
>
>
​When PostgreSQL is done parsing a statement every externally visible
element of that statement needs to have a type. For prepared statements
that means output columns and input parameters. Data types for both either
need to be explicitly stated or inferred from the context of the query as
parsed.

I cannot speak to the SQL standard or other databases. I'm also not
well-versed in the implementation details here - just the observed
behavior. I do suspect some possibility for improvement here but someone
would have to expend considerable time and effort and the lack of comments
from hackers does not bode well for that at this moment (i.e., I don't
think your recommended change works but I'm not experienced enough to say
for certain). You are welcome to compile your own fork with that change
incorporated and run both the PostgreSQL test suite and your application's
test suite. Favorable results there might result in provoking interest
from others.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2017-10-16 15:41:29 Re: Improper const-evaluation of HAVING with grouping sets and subquery pullup
Previous Message Eduardo Pérez Ureta 2017-10-16 15:24:45 Re: BUG #14853: Parameter type is required even when the query does not need to know the type