Re: BUG #16636: Upper case issue in JSONB type

From: ChandraKumar Ovanan <osaimar19(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16636: Upper case issue in JSONB type
Date: 2020-09-26 06:25:28
Message-ID: CAHyU1EYRYCV8gELrBYm6V8E+Toqf=KQe370bPt4yrE_Y1yDZ9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello David,

Thanks a lot, you cleared my question.and it seems fine to me.

You mention boolean type, also the same problem but the document is more
clearled. 🙂

*Just a suggestion: *
The JSON primitive type is null, The document is not cleared such as
lowercase or uppercase.

Please update the document

[image: pql table.PNG]

Regards
Chandrakumar

On Fri, Sep 25, 2020 at 9:08 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Fri, Sep 25, 2020 at 8:13 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:
>>
>> The following bug has been logged on the website:
>>
>> Bug reference: 16636
>> Logged by: ChandraKumar Ovanan
>> Email address: osaimar19(at)gmail(dot)com
>> PostgreSQL version: 11.0
>> Operating system: Windows 10
>> Description:
>>
>> Hi All,
>> Below example which I was execute query in postgres.
>> The problem statement here, when I use upper case function by converting
>> JSONB object has Null value,
>> Then I getting below error.
>> Please could fix it defect or why this behavior on postures,required
>> clarification
>>
>> Error message:
>> SQL Error [22P02]: ERROR: invalid input syntax for type json
>> Detail: Token "NULL" is invalid.
>> Where: JSON data, line 1: ...E": "2018-01-10", "NAME": "TEST3"},
{"DATE":
>> NULL...
>>
>> CREATE TABLE logs(id serial, data JSONB);
>> INSERT INTO logs VALUES
>> (1,
>>
'[{"name":"test1","date":"2020-11-11"},{"name":"test2","date":"2018-01-10"}]'),
>> (2,
>> '[{"name":"test3","date":"2020-05-18"},{"name":"test4","date":"null"}]');
>>
>> SELECT * FROM logs WHERE data @> '[{"date":null}]';
>> SELECT * FROM logs WHERE upper(data::text)::jsonb @>
>> upper('[{"date":"2018-01-10"}]')::jsonb ; --Not working
>>
>
> The error and the example queries don't seem to match...
>
> When you upper('{"date":null}'::text) you get the literal text:
{"date":NULL}, which is not valid json; a JSON null "value" must be written
in lowercase. You would find the same problem had you chosen a boolean
field and written true/false as documented on the json data type page [1],
Table 8.23, and the json standard [2]
>
> David J.
>
> 1. https://www.postgresql.org/docs/13/datatype-json.html
> 2. https://www.json.org/json-en.html
>

--
Thanks & Regards,
Chandra Kumar O
07639078641

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message iT Inject Solar LLP 2020-09-26 14:23:47 could not translate host name "istes.rds.amazonaws.com" to address: Temporary failure in name resolution
Previous Message Peter Geoghegan 2020-09-25 20:51:28 Re: BUG #16624: Query Optimizer - Performance bug related to predicate simplification