PG-1674: Fix query hash calculation comment removal logic

The previous conditions only removed the first few starting characters
of the comment, and leaved everything else there.

This modification fixes this and correctly removes everything.
pull/542/head
Zsolt Parragi 2025-06-20 08:10:03 +01:00
parent 61662cc58f
commit a7908de4a2
1 changed files with 9 additions and 2 deletions

View File

@ -2715,12 +2715,19 @@ get_pgsm_query_id_hash(const char *norm_query, int norm_len)
*/ */
if (*norm_q_iter == '/' && *(norm_q_iter + 1) == '*') if (*norm_q_iter == '/' && *(norm_q_iter + 1) == '*')
{ {
while (*norm_q_iter && *norm_q_iter != '*' && *(norm_q_iter + 1) != '/') while (*norm_q_iter && *(norm_q_iter + 1) && (*norm_q_iter != '*' || *(norm_q_iter + 1) != '/'))
norm_q_iter++; norm_q_iter++;
/* Skip the '/' if the current character is valid. */ /*
* Skip the end if the current character is valid. norm_q_iter
* points to the *, we have to skip 2 characters
*/
if (*norm_q_iter) if (*norm_q_iter)
norm_q_iter++; norm_q_iter++;
if (*norm_q_iter)
norm_q_iter++;
continue;
} }
/* /*