pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: grumpylittleted@googlemail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16909: On update (not insert) the attisdropped flag is set for tables which are recreated with the same col
Date: Tue, 02 Mar 2021 10:40:19 -0500
Message-ID: <939231.1614699619@sss.pgh.pa.us> (raw)
In-Reply-To: <16909-3a6da1ab19f5652b@postgresql.org>
References: <16909-3a6da1ab19f5652b@postgresql.org>

PG Bug reporting form <noreply@postgresql.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





view thread (4+ messages)  latest in thread

Message-ID: <939231.1614699619@sss.pgh.pa.us>
Permalink:  ../939231.1614699619@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/939231.1614699619@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, grumpylittleted@googlemail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16909: On update (not insert) the attisdropped flag is set for tables which are recreated with the same col
  In-Reply-To: <939231.1614699619@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox