Re: Row pattern recognition - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: Row pattern recognition
Date
Msg-id 20260908.145431.752426643759798058.ishii@postgresql.org
Whole thread
In response to Row pattern recognition  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
Hi Henson,

> Hi Tatsuo,
> 
>> execRPR.c:1361:14: error: unused variable 'pattern'
> [-Werror,-Wunused-variable]
>>  1361 |         RPRPattern *pattern = winstate->rpPattern;
>>       |                     ^~~~~~~
> 
> That is nfa_advance_var()'s local.  Only an Assert reads it, so a
> build without --enable-cassert leaves it unused.  Our own builds all
> have cassert on, which is why it never showed up locally.

Yeah, I realized that too.

> In the increment, nocfbot-2013-executor-reads-own-state.txt drops the
> local and has the Assert read winstate->rpPattern directly:
> 
>   Assert(elem->next >= 0 &&
>          elem->next < winstate->rpPattern->numElements);
> 
> It is an error that arose partway through the increment, so fixing it
> is right.  2013 settles it.
> 
> From here on I will run the build and the tests against a release
> build as well.

For v52, I would like the changes to v51 be as small as possible to
avoid confusion (I would like to postion v52 as basically "rebase
only" release). So my plan for v52 is, using PG_USED_FOR_ASSERTS_ONLY
for "pattern" as below. Does this work for you?

diff --git a/src/backend/executor/execRPR.c b/src/backend/executor/execRPR.c
index 68664568556..abff970bf4e 100644
--- a/src/backend/executor/execRPR.c
+++ b/src/backend/executor/execRPR.c
@@ -1358,7 +1358,7 @@ nfa_advance_var(WindowAggState *winstate, RPRNFAContext *ctx,
                                RPRNFAState *state, RPRPatternElement *elem,
                                int64 currentPos)
 {
-       RPRPattern *pattern = winstate->rpPattern;
+       PG_USED_FOR_ASSERTS_ONLY RPRPattern *pattern = winstate->rpPattern;
        int                     depth = elem->depth;
        int32           count = state->counts[depth];
        bool            canLoop = (elem->max == RPR_QUANTITY_INF || count < elem->max);
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp



pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: Revert RI fast-path batching from REL_19_STABLE
Next
From: Hüseyin Demir
Date:
Subject: [PATCH] Report changes discarded for relations not in the subscription