postgresql/src/backend/access/index
Tomas Vondra a82ee7ef3a Check if ii_AmCache is NULL in aminsertcleanup
Fix a bug introduced by c1ec02be1d. It may happen that the executor
opens indexes on the result relation, but no rows end up being inserted.
Then the index_insert_cleanup still gets executed, but passes down NULL
to the AM callback. The AM callback may not expect this, as is the case
of brininsertcleanup, leading to a crash.

Fixed by only calling the cleanup callback if (ii_AmCache != NULL). This
way the AM can simply assume to only see a valid cache.

Reported-by: Richard Guo
Discussion: https://postgr.es/m/CAMbWs4-w9qC-o9hQox9UHvdVZAYTp8OrPQOKtwbvzWaRejTT=Q@mail.gmail.com
2023-11-27 16:53:06 +01:00
..
Makefile Revert "Rename files and headers related to index AM" 2019-12-27 08:09:00 +09:00
amapi.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
amvalidate.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
genam.c Add const to values and nulls arguments 2023-10-10 07:50:43 +02:00
indexam.c Check if ii_AmCache is NULL in aminsertcleanup 2023-11-27 16:53:06 +01:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00