Hello all,

While looking over the new jsonpath stuff I noticed the keyword table
wasn't declared const. Shouldn't the table and the actual keyword
strings both be declared const? Perhaps something like the attached
(untested) patch.

-Mark
diff --git a/src/backend/utils/adt/jsonpath_scan.l b/src/backend/utils/adt/jsonpath_scan.l
index 110ea21..5019b57 100644
--- a/src/backend/utils/adt/jsonpath_scan.l
+++ b/src/backend/utils/adt/jsonpath_scan.l
@@ -287,7 +287,7 @@ typedef struct keyword
 	int16	len;
 	bool	lowercase;
 	int		val;
-	char	*keyword;
+	const char	*keyword;
 } keyword;
 
 /*
@@ -295,7 +295,7 @@ typedef struct keyword
  * alphabetical order
  */
 
-static keyword keywords[] = {
+static const keyword keywords[] = {
 	{ 2, false,	IS_P,		"is"},
 	{ 2, false,	TO_P,		"to"},
 	{ 3, false,	ABS_P,		"abs"},
@@ -324,7 +324,7 @@ checkSpecialVal()
 {
 	int			res = IDENT_P;
 	int			diff;
-	keyword		*StopLow = keywords,
+	const keyword		*StopLow = keywords,
 				*StopHigh = keywords + lengthof(keywords),
 				*StopMiddle;
 

Reply via email to