Re: Row pattern recognition

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: assam258(at)gmail(dot)com
Cc: jian(dot)universality(at)gmail(dot)com, zsolt(dot)parragi(at)percona(dot)com, sjjang112233(at)gmail(dot)com, vik(at)postgresfriends(dot)org, er(at)xs4all(dot)nl, jacob(dot)champion(at)enterprisedb(dot)com, david(dot)g(dot)johnston(at)gmail(dot)com, peter(at)eisentraut(dot)org, li(dot)evan(dot)chao(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Row pattern recognition
Date: 2026-09-08 05:54:31
Message-ID: 20260908.145431.752426643759798058.ishii@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hüseyin Demir 2026-09-08 05:59:24 [PATCH] Report changes discarded for relations not in the subscription
Previous Message Zhijie Hou (Fujitsu) 2026-09-08 05:24:25 RE: Publication DDL can race with a concurrent UPDATE