From 11c3b981fbf80eaa6f21130b2e9e59df4855df2c Mon Sep 17 00:00:00 2001
From: "David E. Wheeler" <david@justatheory.com>
Date: Mon, 2 Jun 2025 17:14:10 -0400
Subject: [PATCH v9 1/2] Rename jsonpath method arg tokens

Rename the `csv_` tokens to `int_`, because they represent signed or
unsigned integers, as follows:

*   `csv_elem` => `int_elem`
*   `csv_list` => `int_list`
*   `opt_csv_list` => `opt_int_list`

Rename the `datetime_precision` tokens to `uint_arg`, as they represent
unsigned integers and will be useful for other methods in the future, as
follows:

*   `datetime_precision` => `uint_elem`
*   `opt_datetime_precision` => `opt_uint_arg`

Rename the `datetime_template` tokens to `str_arg`, as they represent
strings and will be useful for other methods in the future, as follows:

*   `datetime_template` => `str_elem`
*   `opt_datetime_template` => `opt_str_arg`
---
 src/backend/utils/adt/jsonpath_gram.y | 42 +++++++++++++--------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/backend/utils/adt/jsonpath_gram.y b/src/backend/utils/adt/jsonpath_gram.y
index 499745a8fef..0b16cec18c4 100644
--- a/src/backend/utils/adt/jsonpath_gram.y
+++ b/src/backend/utils/adt/jsonpath_gram.y
@@ -92,10 +92,10 @@ static bool makeItemLikeRegex(JsonPathParseItem *expr,
 %type	<value>		scalar_value path_primary expr array_accessor
 					any_path accessor_op key predicate delimited_predicate
 					index_elem starts_with_initial expr_or_predicate
-					datetime_template opt_datetime_template csv_elem
-					datetime_precision opt_datetime_precision
+					str_elem opt_str_arg int_elem
+					uint_elem opt_uint_arg
 
-%type	<elems>		accessor_expr csv_list opt_csv_list
+%type	<elems>		accessor_expr int_list opt_int_list
 
 %type	<indexs>	index_list
 
@@ -254,7 +254,7 @@ accessor_op:
 	| '.' any_path					{ $$ = $2; }
 	| '.' method '(' ')'			{ $$ = makeItemType($2); }
 	| '?' '(' predicate ')'			{ $$ = makeItemUnary(jpiFilter, $3); }
-	| '.' DECIMAL_P '(' opt_csv_list ')'
+	| '.' DECIMAL_P '(' opt_int_list ')'
 		{
 			if (list_length($4) == 0)
 				$$ = makeItemBinary(jpiDecimal, NULL, NULL);
@@ -268,19 +268,19 @@ accessor_op:
 						 errmsg("invalid input syntax for type %s", "jsonpath"),
 						 errdetail(".decimal() can only have an optional precision[,scale].")));
 		}
-	| '.' DATETIME_P '(' opt_datetime_template ')'
+	| '.' DATETIME_P '(' opt_str_arg ')'
 		{ $$ = makeItemUnary(jpiDatetime, $4); }
-	| '.' TIME_P '(' opt_datetime_precision ')'
+	| '.' TIME_P '(' opt_uint_arg ')'
 		{ $$ = makeItemUnary(jpiTime, $4); }
-	| '.' TIME_TZ_P '(' opt_datetime_precision ')'
+	| '.' TIME_TZ_P '(' opt_uint_arg ')'
 		{ $$ = makeItemUnary(jpiTimeTz, $4); }
-	| '.' TIMESTAMP_P '(' opt_datetime_precision ')'
+	| '.' TIMESTAMP_P '(' opt_uint_arg ')'
 		{ $$ = makeItemUnary(jpiTimestamp, $4); }
-	| '.' TIMESTAMP_TZ_P '(' opt_datetime_precision ')'
+	| '.' TIMESTAMP_TZ_P '(' opt_uint_arg ')'
 		{ $$ = makeItemUnary(jpiTimestampTz, $4); }
 	;
 
-csv_elem:
+int_elem:
 	INT_P
 		{ $$ = makeItemNumeric(&$1); }
 	| '+' INT_P %prec UMINUS
@@ -289,31 +289,31 @@ csv_elem:
 		{ $$ = makeItemUnary(jpiMinus, makeItemNumeric(&$2)); }
 	;
 
-csv_list:
-	csv_elem						{ $$ = list_make1($1); }
-	| csv_list ',' csv_elem			{ $$ = lappend($1, $3); }
+int_list:
+	int_elem						{ $$ = list_make1($1); }
+	| int_list ',' int_elem			{ $$ = lappend($1, $3); }
 	;
 
-opt_csv_list:
-	csv_list						{ $$ = $1; }
+opt_int_list:
+	int_list						{ $$ = $1; }
 	| /* EMPTY */					{ $$ = NULL; }
 	;
 
-datetime_precision:
+uint_elem:
 	INT_P							{ $$ = makeItemNumeric(&$1); }
 	;
 
-opt_datetime_precision:
-	datetime_precision				{ $$ = $1; }
+opt_uint_arg:
+	uint_elem						{ $$ = $1; }
 	| /* EMPTY */					{ $$ = NULL; }
 	;
 
-datetime_template:
+str_elem:
 	STRING_P						{ $$ = makeItemString(&$1); }
 	;
 
-opt_datetime_template:
-	datetime_template				{ $$ = $1; }
+opt_str_arg:
+	str_elem						{ $$ = $1; }
 	| /* EMPTY */					{ $$ = NULL; }
 	;
 
-- 
2.49.0

