Re: Bug #951: Creating table fails if inherited table has no columns. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #951: Creating table fails if inherited table has no columns.
Date
Msg-id 29600.1050938650@sss.pgh.pa.us
Whole thread Raw
In response to Bug #951: Creating table fails if inherited table has no columns.  (pgsql-bugs@postgresql.org)
List pgsql-bugs
pgsql-bugs@postgresql.org writes:
> Creating table fails if inherited table has no columns.

Good catch.  Here's the patch if you need it right away.

            regards, tom lane

*** src/backend/commands/tablecmds.c~    Mon Dec 16 13:39:56 2002
--- src/backend/commands/tablecmds.c    Mon Apr 21 11:20:02 2003
***************
*** 576,584 ****
           * newattno[] will contain the child-table attribute numbers for
           * the attributes of this parent table.  (They are not the same
           * for parents after the first one, nor if we have dropped
!          * columns.)
           */
!         newattno = (AttrNumber *) palloc(tupleDesc->natts * sizeof(AttrNumber));

          for (parent_attno = 1; parent_attno <= tupleDesc->natts;
               parent_attno++)
--- 576,585 ----
           * newattno[] will contain the child-table attribute numbers for
           * the attributes of this parent table.  (They are not the same
           * for parents after the first one, nor if we have dropped
!          * columns.)  +1 is to prevent error if parent has zero columns.
           */
!         newattno = (AttrNumber *)
!             palloc((tupleDesc->natts + 1) * sizeof(AttrNumber));

          for (parent_attno = 1; parent_attno <= tupleDesc->natts;
               parent_attno++)

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #951: Creating table fails if inherited table has no columns.
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #952: real type in WHERE