PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> On update (not insert) the attisdropped flag is set for tables which are
> recreated with the same column names as the original but where preceding
> columns have been dropped
I think this is just faulty C code.
> for( int i = 1; i <= tupdesc->natts; i++ ) {
> elog( INFO, "attr num=%d attisdropped=%d", i, TupleDescAttr( tupdesc, i
> )->attisdropped );
> }
The index argument of TupleDescAttr needs to run from 0 to natts-1.
As coded, this is fetching off the end of the array and getting garbage.
The mistake might've been more obvious if you'd tried to print any
non-boolean fields of the tupledesc.
regards, tom lane