Re: Missing CFI in iterate_word_similarity()
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Robins Tharakan <tharakan@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2022-09-02T13:16:13Z
Lists: pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 2 Sep 2022, at 14:57, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I noticed the same thing, but sticking the CFI immediately after the
>> declaration didn't read well either. I was considering moving it to
>> the bottom of the loop instead of that.
> I was contemplating that too, but kept it at the top after seeing quite a few
> examples of that in other contrib modules (like amcheck/verify_nbtree.c and
> pg_visibility/pg_visibility.c). I don't have any strong feelings either way,
> I'm happy to move it last.
You could keep it at the top, but then I'd be inclined to split up
the existing code:
int trgindex;
CHECK_FOR_INTERRUPTS();
/* Get index of next trigram */
trgindex = trg2indexes[i];
/* Update last position of this trigram */
...
What's annoying me about the one-liner fix is that it makes it
look like CFI is part of the "Get index" action.
regards, tom lane
Commits
-
Update out of date comments in pg_trgm
- 6dc0738812c3 16.0 landed
-
Check for interrupts in pg_trgm word similarity
- ae4fc52ae247 16.0 landed
-
Add strict_word_similarity to pg_trgm module
- be8a7a686627 11.0 cited