Re: BUG #16909: On update (not insert) the attisdropped flag is set for tables which are recreated with the same col

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: grumpylittleted(at)googlemail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16909: On update (not insert) the attisdropped flag is set for tables which are recreated with the same col
Date: 2021-03-02 15:40:19
Message-ID: 939231.1614699619@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Grumpy LittleTed 2021-03-02 16:48:20 Re: BUG #16909: On update (not insert) the attisdropped flag is set for tables which are recreated with the same col
Previous Message Hamid Akhtar 2021-03-02 14:16:35 Re: BUG #16909: On update (not insert) the attisdropped flag is set for tables which are recreated with the same col