Re: Clean up JumbleQuery() from query text

2023-06-27 Thread Michael Paquier
On Mon, Jun 26, 2023 at 08:51:17AM -0700, Nathan Bossart wrote:
> On Mon, Jun 26, 2023 at 05:44:49PM +0900, Michael Paquier wrote:
>> It is not urgent, so I am fine to postpone that after beta2 is
>> released on 17~ if there are any objections to that, of course.
> 
> Even if extensions are using it, GA for v16 is still a few months away, so
> IMO it's okay to apply it to v16.

Okay, thanks.  I am adding the RMT in CC in case there are any
objections, but I guess that this one will be OK even if applied in
the next couple of days for 16.
--
Michael


signature.asc
Description: PGP signature


Re: Clean up JumbleQuery() from query text

2023-06-26 Thread Nathan Bossart
On Mon, Jun 26, 2023 at 05:44:49PM +0900, Michael Paquier wrote:
> Joe has reported me offlist that JumbleQuery() includes a dependency
> to the query text, but we don't use that anymore as the query ID is
> generated from the Query structure instead.
> 
> Any thoughts about the cleanup attached?  But at the same time, this
> is simple and a new thing, so I'd rather clean up that now rather than
> later. 

LGTM

> It is not urgent, so I am fine to postpone that after beta2 is
> released on 17~ if there are any objections to that, of course.

Even if extensions are using it, GA for v16 is still a few months away, so
IMO it's okay to apply it to v16.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com




Clean up JumbleQuery() from query text

2023-06-26 Thread Michael Paquier
Hi all,

Joe has reported me offlist that JumbleQuery() includes a dependency
to the query text, but we don't use that anymore as the query ID is
generated from the Query structure instead.

Any thoughts about the cleanup attached?  But at the same time, this
is simple and a new thing, so I'd rather clean up that now rather than
later. 

It is not urgent, so I am fine to postpone that after beta2 is
released on 17~ if there are any objections to that, of course.

Thoughts?
--
Michael
diff --git a/src/include/nodes/queryjumble.h b/src/include/nodes/queryjumble.h
index 3499bfd4a0..7649e095aa 100644
--- a/src/include/nodes/queryjumble.h
+++ b/src/include/nodes/queryjumble.h
@@ -64,7 +64,7 @@ extern PGDLLIMPORT int compute_query_id;
 
 
 extern const char *CleanQuerytext(const char *query, int *location, int *len);
-extern JumbleState *JumbleQuery(Query *query, const char *querytext);
+extern JumbleState *JumbleQuery(Query *query);
 extern void EnableQueryId(void);
 
 extern PGDLLIMPORT bool query_id_enabled;
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 15f9bddcdf..8570b14f62 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -255,7 +255,7 @@ ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
 
 	query = castNode(Query, stmt->query);
 	if (IsQueryIdEnabled())
-		jstate = JumbleQuery(query, pstate->p_sourcetext);
+		jstate = JumbleQuery(query);
 
 	if (post_parse_analyze_hook)
 		(*post_parse_analyze_hook) (pstate, query, jstate);
diff --git a/src/backend/nodes/queryjumblefuncs.c b/src/backend/nodes/queryjumblefuncs.c
index d7fd72d70f..281907a4d8 100644
--- a/src/backend/nodes/queryjumblefuncs.c
+++ b/src/backend/nodes/queryjumblefuncs.c
@@ -97,7 +97,7 @@ CleanQuerytext(const char *query, int *location, int *len)
 }
 
 JumbleState *
-JumbleQuery(Query *query, const char *querytext)
+JumbleQuery(Query *query)
 {
 	JumbleState *jstate = NULL;
 
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 70932dba61..4006632092 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -124,7 +124,7 @@ parse_analyze_fixedparams(RawStmt *parseTree, const char *sourceText,
 	query = transformTopLevelStmt(pstate, parseTree);
 
 	if (IsQueryIdEnabled())
-		jstate = JumbleQuery(query, sourceText);
+		jstate = JumbleQuery(query);
 
 	if (post_parse_analyze_hook)
 		(*post_parse_analyze_hook) (pstate, query, jstate);
@@ -166,7 +166,7 @@ parse_analyze_varparams(RawStmt *parseTree, const char *sourceText,
 	check_variable_parameters(pstate, query);
 
 	if (IsQueryIdEnabled())
-		jstate = JumbleQuery(query, sourceText);
+		jstate = JumbleQuery(query);
 
 	if (post_parse_analyze_hook)
 		(*post_parse_analyze_hook) (pstate, query, jstate);
@@ -203,7 +203,7 @@ parse_analyze_withcb(RawStmt *parseTree, const char *sourceText,
 	query = transformTopLevelStmt(pstate, parseTree);
 
 	if (IsQueryIdEnabled())
-		jstate = JumbleQuery(query, sourceText);
+		jstate = JumbleQuery(query);
 
 	if (post_parse_analyze_hook)
 		(*post_parse_analyze_hook) (pstate, query, jstate);


signature.asc
Description: PGP signature