diff options
author | Amit Langote <amitlan@postgresql.org> | 2025-03-13 09:56:36 +0900 |
---|---|---|
committer | Amit Langote <amitlan@postgresql.org> | 2025-03-13 09:56:36 +0900 |
commit | d4f79865d4207bd93fa00f521638c289f036e276 (patch) | |
tree | fa7719e3b9f6740bfcd8fe8cefc7fe69bc70e197 /src/backend/utils/adt/arrayfuncs.c | |
parent | 4ecdd4110d5cbaf107c0c85d16df78dffe0a9574 (diff) | |
download | postgresql-d4f79865d4207bd93fa00f521638c289f036e276.tar.gz postgresql-d4f79865d4207bd93fa00f521638c289f036e276.zip |
Fix copy-paste error in datum_to_jsonb_internal()
Commit 3c152a27b06 mistakenly repeated JSONTYPE_JSON in a condition,
omitting JSONTYPE_CAST. As a result, datum_to_jsonb_internal() failed
to reject inputs that were casts (e.g., from an enum to json as in the
example below) when used as keys in JSON constructors.
This led to a crash in cases like:
SELECT JSON_OBJECT('happy'::mood: '123'::jsonb);
where 'happy'::mood is implicitly cast to json. The missing check
meant such casted values weren’t properly rejected as invalid
(non-scalar) JSON keys.
Reported-by: Maciek Sakrejda <maciek@pganalyze.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Maciek Sakrejda <maciek@pganalyze.com>
Discussion: https://postgr.es/m/CADXhmgTJtJZK9A3Na_ry+Xrq-ghjcejBRhcRMzWZvbd__QdgJA@mail.gmail.com
Backpatch-through: 17
Diffstat (limited to 'src/backend/utils/adt/arrayfuncs.c')
0 files changed, 0 insertions, 0 deletions