Re: Fix missing FORMAT when deparsing JSON_ARRAY(query)

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix missing FORMAT when deparsing JSON_ARRAY(query)
Date: 2026-07-23 09:19:49
Message-ID: AC75416C-0958-4B35-969D-7311B58915CD@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Jul 23, 2026, at 16:57, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> On Wed, Jul 22, 2026 at 3:22 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>> Currently, JsonConstructorExpr does not store the JsonFormat information. To fix this problem, we need to add a JsonFormat field to JsonConstructorExpr. Please see the attached patch for details.
>
> I considered recovering the format from func, as the arg that carries
> the format lives there. However, reaching it requires walking a
> complex CoalesceExpr tree to find the JsonValueExpr, which seems too
> fragile.
>
> So, recording the input FORMAT in JsonConstructorExpr for deparsing
> seems like the most feasible approach.
>
> Regarding the patch, I don't think we need to handle format in
> expression_tree_mutator/walker. I also don't think we need to
> copyObject the format. Other than that, the patch LGTM.

Agreed, looks like format is immutable, so copy is not needed.

>
> I plan to push the attached patch soon barring any objections.
>
> - Richard
> <v2-0001-Fix-deparsing-of-JSON_ARRAY-subquery-with-a-FORMA.patch>

V2 looks good.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alena Rybakina 2026-07-23 09:20:03 Re: Vacuum statistics
Previous Message Feike Steenbergen 2026-07-23 09:17:27 Re: BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64