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

From: Eduardo Pérez Ureta <edpeur(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: 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 17:39:31
Message-ID: CAM7oS3FkCsSRM_W4xhuujuV8tv=VLVPCPA3z3UNzV0WY2uaP8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I ran the PostgreSQL test suite (make check) and all the tests passed, so,
my change should not break anything.
Maybe PostgreSQL should be changed to not require a type in this case.

On Oct 16, 2017 5:39 PM, "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

> 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 Eduardo Pérez Ureta 2017-10-16 17:39:43 Re: BUG #14853: Parameter type is required even when the query does not need to know the type
Previous Message Tomas Vondra 2017-10-16 16:32:57 Re: BUG #14853: Parameter type is required even when the query does not need to know the type