Re: BUG #14268: NULL parameter conversion

From: Jordan Gigov <coladict(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" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14268: NULL parameter conversion
Date: 2016-07-28 19:54:33
Message-ID: CA+nBocCXCvb3G0y7tsjE+GJ2E0OJfWXK6kTqQV8N02t6J=RKjQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

So, you're saying SQL is too sane a language for you and you'd rather have
30+ non-convertible types of null?

2016-07-28 16:56 GMT+03:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:

> On Thu, Jul 28, 2016 at 9:30 AM, <coladict(at)gmail(dot)com> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference: 14268
>> Logged by: Jordan Gigov
>> Email address: coladict(at)gmail(dot)com
>> PostgreSQL version: 9.3.13
>> Operating system: Ubuntu 14.04
>> Description:
>
> ​[...]​
>
>>
>>
> When the value is NULL, the type
>> shouldn't matter.
>>
>
> ​According to what authority?
>
> ​[...]
>>
> INSERT INTO my_array_table(somedata) VALUES (NULL::bytea);
>>
>
> ​If you are saying the above should work I'd say that is arguable at
> best.​ All values, even NULL, are typed in PostgreSQL.
>
>
>> I recognize that the JDBC driver explicitly sends the parameter type in a
>> prepared statement, but I think it should be ignored when the value is
>> NULL.
>>
>
> ​As your first example shows if the NULL remains unknown it will be
> auto-cast according to the context in which it is used. Its not
> PostgreSQL's place to discard type information.
>
> ​The JDBC API defines "setNull(int parameterIndex, int​ sqlType); which
> makes me inclined to say your complaint should be directed at JPA and not
> either PostgreSQL itself or JDBC.
>
> Now, as I am lacking knowledge about the specific problem, JPA, and how
> other databases function, I am unable to meaningfully comment further. But
> I can say this isn't a bug. PostgreSQL is operating as expected given how
> it handles NULL.
>
> David J.
>
>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2016-07-28 20:01:34 Re: BUG #14268: NULL parameter conversion
Previous Message Tom Lane 2016-07-28 17:34:24 Re: bug error message constraint "con_item_id_costelement" for table "costs" does not exist SQL state: 42704