[MASSMAIL]Is it safe to cache data by GiST consistent function - Mailing list pgsql-hackers

From Michał Kłeczek
Subject [MASSMAIL]Is it safe to cache data by GiST consistent function
Date
Msg-id 3F12E994-B9E7-4308-9E18-5F01E28F55AC@kleczek.org
Whole thread Raw
Responses Re: Is it safe to cache data by GiST consistent function
List pgsql-hackers
Hello,

When implementing a GiST consistent function I found the need to cache pre-processed query across invocations.
I am not sure if it is safe to do (or I need to perform some steps to make sure cached info is not leaked between
rescans).

The comment in gistrescan says:

        /*
         * If this isn't the first time through, preserve the fn_extra
         * pointers, so that if the consistentFns are using them to cache
         * data, that data is not leaked across a rescan.
         */

which seems to me self-contradictory as fn_extra is preserved between rescans (so leaks are indeed possible).

Am I missing something?

Thanks,
Michal


pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Confusing #if nesting in hmac_openssl.c
Next
From: Bertrand Drouvot
Date:
Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation