From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Tender Wang <tndrwang(at)gmail(dot)com>, Maciek Sakrejda <maciek(at)pganalyze(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Question about duplicate JSONTYPE_JSON check |
Date: | 2025-03-12 12:26:55 |
Message-ID: | CA+HiwqE5wrm7ry-d6KkHk+KucOSg+RN3Gr8_0Axqe7dAoTijDQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Mar 12, 2025 at 7:09 PM Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> On 2025-Mar-12, Amit Langote wrote:
>
> > I was able to construct a test case that crashes due to this bug:
> >
> > CREATE TYPE mood AS ENUM ('happy', 'sad', 'neutral');
> > CREATE FUNCTION mood_to_json(mood) RETURNS json AS $$
> > SELECT to_json($1::text);
> > $$ LANGUAGE sql IMMUTABLE;
> > CREATE CAST (mood AS json) WITH FUNCTION mood_to_json(mood) AS IMPLICIT;
> >
> > SELECT JSON_OBJECT('happy'::mood: '123'::jsonb);
> > server closed the connection unexpectedly
>
> Good reaction time :-) I see that that line shows as not even uncovered
> in the report, but as non-existant (no background color as opposed to
> red):
>
> https://coverage.postgresql.org/src/backend/utils/adt/jsonb.c.gcov.html#660
>
> Evidently the compiler must be optimizing it out as dead code.
Ah, I did wonder about the coverage, thanks for pointing it out.
Patch look good for committing?
--
Thanks, Amit Langote
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2025-03-12 12:28:49 | Re: Test mail for pgsql-hackers |
Previous Message | Hayato Kuroda (Fujitsu) | 2025-03-12 12:15:58 | RE: Selectively invalidate caches in pgoutput module |