Re: JSON Functions and Operators Docs for v15

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Erik Rijkers <er(at)xs4all(dot)nl>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: JSON Functions and Operators Docs for v15
Date: 2022-05-16 19:02:27
Message-ID: 3e6e122d-b562-fd6b-8f37-81275891ce13@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2022-05-16 Mo 14:53, Andrew Dunstan wrote:
> On 2022-05-16 Mo 13:52, Erik Rijkers wrote:
>> Op 16-05-2022 om 16:49 schreef Andrew Dunstan:
>>
>>> [sqljson-dox-rework-2.patch]
>> Two issues, derived from func.sgml:
>>
>> -----
>> 1.
>>
>> I noticed that some json functions, for instance json_object(), in
>> their output insert unexpected spaces before the separator-colon:
>>
>> testdb=# select json_object('{a, 1, b, "def", c, 3.5}');
>>
>>               json_object
>> ---------------------------------------
>>  {"a" : "1", "b" : "def", "c" : "3.5"}
>> (1 row)
>>
>> instead of the expected
>>  {"a": "1", "b": "def", "c": "3.5"}
>>
>> Of course not outright wrong but wouldn't it make more sense to
>> normalize such output?  There is here no reason in the input to space
>> the colon on both sides.
>>
>> Functions that yield this peculiarly spaced output are:
>>   json_object
>>   json_objectagg
>>   json_build_object
>>
> Well, yes, possibly, but  don't think we're going to change the behavior
> now, it might break things.
>
>
>> -----
>> 2.
>>
>> This example in func.sgml says it gives 't' but on my instance it
>> returns 'f'.  Is the example correct?
>>
>> jsonb_path_exists_tz('["2015-08-01 12:00:00 -05"]', '$[*] ?
>> (@.datetime() < "2015-08-02".datetime())') → t
>
>
> Yeah, it doesn't like the format of the timestamp literal. It works with
> "2015-08-01T12:00:0 -05". I'll fix the example in the next version.

Or rather "2015-08-01T12:00:00-05"

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Rijkers 2022-05-16 19:06:59 Re: JSON Functions and Operators Docs for v15
Previous Message Andrew Dunstan 2022-05-16 18:53:55 Re: JSON Functions and Operators Docs for v15