Re: Bug #951: Creating table fails if inherited table has no columns.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mig-O(at)artis(dot)uni-oldenburg(dot)de, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #951: Creating table fails if inherited table has no columns.
Date: 2003-04-21 15:24:10
Message-ID: 29600.1050938650@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)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++)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mig-O 2003-04-21 16:13:58 Re: Bug #951: Creating table fails if inherited table has no columns.
Previous Message pgsql-bugs 2003-04-21 14:18:31 Bug #951: Creating table fails if inherited table has no columns.