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

  1. Update out of date comments in pg_trgm

  2. Check for interrupts in pg_trgm word similarity

  3. Add strict_word_similarity to pg_trgm module