Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type
Date
Msg-id CAKFQuwY2ce_MPA1NfURTy_O-XY6whj9eODPu6FA5r_k0q9dSKw@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type  (Eduardo Pérez Ureta <edpeur@gmail.com>)
Responses Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type  (Eduardo Pérez Ureta <edpeur@gmail.com>)
List pgsql-bugs
On Mon, Oct 16, 2017 at 8:24 AM, Eduardo Pérez Ureta <edpeur@gmail.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.

pgsql-bugs by date:

Previous
From: Eduardo Pérez Ureta
Date:
Subject: Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type
Next
From: Andrew Gierth
Date:
Subject: Re: [BUGS] Improper const-evaluation of HAVING with grouping sets and subquery pullup