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

Поиск
Список
Период
Сортировка
Искать

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

От:
"Dewei Dai" <daidewei1970@163.com>
Дата:
Вложения:
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/


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

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Nov 18, 2026, at 17:50, Dewei Dai  wrote:
> 
> 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/
> 
> 
> 

Thanks for updating the patch. V2 looks good to me.

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






FAQ