Re: Ambiguity in IS JSON description and logic

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: r314tive <tanswis42(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Kirk Parker <khp(at)equatoria(dot)us>, vavankaru(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Ambiguity in IS JSON description and logic
Date: 2025-11-18 16:37:21
Message-ID: 109c4b7c676cfde0d9c8666fa2c1f0063453df18.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

On Tue, 2025-11-18 at 16:55 +0500, r314tive wrote:
> Based on this discussion, I’ve prepared a small documentation patch that
> tries to clarify the behavior of the IS JSON ... UNIQUE KEYS clause.
>
> The patch explains that:
> - the WITH/WITHOUT UNIQUE KEYS clause controls an additional test on
>   duplicate object keys,
> - WITH UNIQUE KEYS requires that no object contained in the expression
>   (recursively) have duplicate keys, and
> - WITHOUT UNIQUE KEYS, which is also the default, just disables this
>   additional test and does not require duplicates to be present.
>
> Patch is attached.

I don't think that the patch is really an improvement. To me, the original
wording contains all the important information. The patch it somewhat
repetetive and contains unnecessary detail. For example, I can see from
the syntax diagram that I can use WITHOUT UNIQUE KEYS, and I have no
trouble guessing what that means.

Perhaps it would be enough to add something like "*recursively* checks for
duplicate keys" or "checks for duplicate keys *on any nesting level*".

Yours,
Laurenz Albe

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-11-18 16:49:12 Re: *_LAST in enums to define NUM* macross
Previous Message Nathan Bossart 2025-11-18 16:33:57 Re: postgresql.conf.sample tab width

Browse pgsql-docs by date

  From Date Subject
Previous Message Ilmar Y 2025-11-18 11:56:50 Re: Ambiguity in IS JSON description and logic