On Sun, Oct 22, 2023 at 02:02:45PM -0700, Noah Misch wrote:
> - /* OK, do it */
> - brinsummarize(indexRel, heapRel, heapBlk, true, &numSummarized, NULL);
> + /* see gin_clean_pending_list() */
> + if (indexRel->rd_index->indisvalid)
> + brinsummarize(indexRel, heapRel, heapBlk, true, &numSummarized, NULL);
> + else
> + ereport(DEBUG1,
> + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> + errmsg("index \"%s\" is not valid",
> + RelationGetRelationName(indexRel))));
brinsummarize() could return 0 even for a valid index, and we would
not be able to make the difference with an invalid index. Perhaps you
are right and this is not a big deal in practice to do as you are
suggesting.
--
Michael