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 980c1a85d8.

Suggested-by: Junwang Zhao <zhjwpku@gmail.com> (offlist)
Discussion: https://www.postgresql.org/message-id/CADfhSr-pCkbDxmiOVYSAGE5QGjsQ48KKH_W424SPk%2BpwzKZFaQ%40mail.gmail.com
This commit is contained in:
Amit Langote 2026-04-10 15:24:38 +09:00
parent 980c1a85d8
commit 155c03ee9d

View file

@ -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],