Fix shadow variable in postgres.c
authorMichael Paquier <[email protected]>
Wed, 12 Oct 2022 04:42:30 +0000 (13:42 +0900)
committerMichael Paquier <[email protected]>
Wed, 12 Oct 2022 04:42:30 +0000 (13:42 +0900)
-Wshadow=compatible-local is added by default since 0fe954c, and this
warning was detected under -DWRITE_READ_PARSE_PLAN_TREES.

Reviewed-by: David Rowley
Discussion: https://postgr.es/m/[email protected]

src/backend/tcop/postgres.c

index 5352d5f4c6bbef7626641015dd7f0719b5d0c174..27dee29f420b95c1b77c64198a1f504bdb275f33 100644 (file)
@@ -815,15 +815,15 @@ pg_rewrite_query(Query *query)
 
        foreach(lc, querytree_list)
        {
-           Query      *query = lfirst_node(Query, lc);
-           char       *str = nodeToString(query);
+           Query      *curr_query = lfirst_node(Query, lc);
+           char       *str = nodeToString(curr_query);
            Query      *new_query = stringToNodeWithLocations(str);
 
            /*
             * queryId is not saved in stored rules, but we must preserve it
             * here to avoid breaking pg_stat_statements.
             */
-           new_query->queryId = query->queryId;
+           new_query->queryId = curr_query->queryId;
 
            new_list = lappend(new_list, new_query);
            pfree(str);