回复: Re: [PATCH] Reject duplicate SQL/JSON PASSING argument names

From: "Dewei Dai" <daidewei1970(at)163(dot)com>
To: li(dot)evan(dot)chao <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: "Pgsql Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: 回复: Re: [PATCH] Reject duplicate SQL/JSON PASSING argument names
Date: 2026-11-18 09:50:54
Message-ID: 2026111817505353731420@163.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the review.

On 2026-11-18 14:31:33, Chao Li wrote:
> 1
> --- a/src/backend/parser/parse_expr.c
> +++ b/src/backend/parser/parse_expr.c
> ...
> The result of transformJsonValueExpr() doesn't matter for the dup name check, so we can do the check before calling transformJsonValueExpr().

Fixed. I moved the duplicate name check before calling transformJsonValueExpr().

> 2
> ...
> Modern ereport() style doesn't require the extra parentheses around errcode(), errmsg(), etc. Since this file already has a mix of old and new styles, I think we should use the modern style for new code.

Fixed. I updated the new ereport() call to use the modern style without extra parentheses.

> 3. The current doc in func-json.sgml doesn't explicitly say anything about duplicate PASSING argument names:
> ...
> So, I think this patch should update the doc accordingly, for example, adding a simple sentence saying that duplicate PASSING argument names are not allowed.

Fixed. I added a sentence to func-json.sgml stating that the names of the variables in the PASSING clause must be unique.

> 4. The tests cover JSON_QUERY and JSON_TABLE, but as you explained in the patch email, JSON_EXISTS and JSON_VALUE are also affected. Maybe add test cases for JSON_EXISTS and JSON_VALUE as well.

Fixed. I added regression tests for JSON_EXISTS and JSON_VALUE.

> 5. Maybe also mention JSON_EXISTS, JSON_QUERY, and JSON_VALUE in the commit message, as they are fixed by this patch as well.

Fixed. I updated the commit message to mention all affected functions.

Best regards,
Dewei Dai

HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v2-0001-Reject-duplicate-SQL-JSON-PASSING-argument-names.patch application/octet-stream 7.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-11-18 10:01:39 Re: Use local buffer for packed numerics
Previous Message Bertrand Drouvot 2026-11-18 09:45:49 Re: Fix ReadStream handling when heap rescan strategy changes