From: Amit Langote Date: Fri, 10 Apr 2026 06:24:38 +0000 (+0900) Subject: Assert index_attnos[0] == 1 in ri_FastPathFlushArray() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=155c03ee9d449589fa93aabcac41d643d03875b9;p=thirdparty%2Fpostgresql.git Assert index_attnos[0] == 1 in ri_FastPathFlushArray() ri_FastPathFlushArray() handles single-column FKs only, so index_attnos[0] is always 1. Add an Assert to make this invariant explicit, as a followup to 980c1a85d819. Suggested-by: Junwang Zhao (offlist) Discussion: https://www.postgresql.org/message-id/CADfhSr-pCkbDxmiOVYSAGE5QGjsQ48KKH_W424SPk%2BpwzKZFaQ%40mail.gmail.com --- diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 09a5ab24e56..e060280fcd4 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -3097,10 +3097,10 @@ ri_FastPathFlushArray(RI_FastPathEntry *fpentry, TupleTableSlot *fk_slot, * * PK indexes are always btree, which supports SK_SEARCHARRAY. * - * Reference index_attnos[0] for attribute number and collation since this - * is a single-column fast path. + * This path handles single-column FKs only, so index_attnos[0] == 1. */ Assert(idx_rel->rd_indam->amsearcharray); + Assert(fpmeta->index_attnos[0] == 1); ScanKeyEntryInitialize(&skey[0], SK_SEARCHARRAY, fpmeta->index_attnos[0],