From: | Tender Wang <tndrwang(at)gmail(dot)com> |
---|---|
To: | Maciek Sakrejda <maciek(at)pganalyze(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com> |
Subject: | Re: Question about duplicate JSONTYPE_JSON check |
Date: | 2025-03-12 01:00:22 |
Message-ID: | CAHewXNkAPk=pScrf6bT8cwqiZMM7RyaGHuSMGykKiWDHV6jkVQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Maciek Sakrejda <maciek(at)pganalyze(dot)com> 于2025年3月11日周二 08:12写道:
> While exploring the jsonb code, I noticed that in
> datum_to_jsonb_internal, the tcategory checks compares against
> JSONTYPE_JSON twice. There's no reason for that, right?
>
Yeah, the second JSONTYPE_JSON seems redundant.
>
> ...
>
> Ok, so, to try to answer my own question, I went looking at the
> history, and this comes from "Unify JSON categorize type API and
> export for external use" [0]. Specifically, the change was
>
> - (tcategory == JSONBTYPE_ARRAY ||
> - tcategory == JSONBTYPE_COMPOSITE ||
> - tcategory == JSONBTYPE_JSON ||
> - tcategory == JSONBTYPE_JSONB ||
> - tcategory == JSONBTYPE_JSONCAST))
> + (tcategory == JSONTYPE_ARRAY ||
> + tcategory == JSONTYPE_COMPOSITE ||
> + tcategory == JSONTYPE_JSON ||
> + tcategory == JSONTYPE_JSONB ||
> + tcategory == JSONTYPE_JSON))
>
> So "JSONBTYPE_JSONCAST" turned into "JSONTYPE_JSON". Should that have
> been "JSONTYPE_CAST" (that seems to be the corresponding value in the
> new enum) instead?
>
The below else branch has code if (tcategory == JSONTYPE_CAST). I guess
here the
second JSONTYPE_JSON may just be removed.
@Amit Langote <amitlangote09(at)gmail(dot)com> please check out this.
--
Thanks,
Tender Wang
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2025-03-12 01:02:35 | Re: Conflict detection for multiple_unique_conflicts in logical replication |
Previous Message | Michael Paquier | 2025-03-12 00:51:06 | Re: Query ID Calculation Fix for DISTINCT / ORDER BY and LIMIT / OFFSET |