Skip to content
Snippets Groups Projects
Commit ca944bd2 authored by Tom Lane's avatar Tom Lane
Browse files

Prevent palloc(0) error when parent table has zero columns.

parent 185ad7a8
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.70 2003/03/21 15:43:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.71 2003/04/21 15:19:55 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -591,9 +591,10 @@ MergeAttributes(List *schema, List *supers, bool istemp, ...@@ -591,9 +591,10 @@ MergeAttributes(List *schema, List *supers, bool istemp,
* newattno[] will contain the child-table attribute numbers for * newattno[] will contain the child-table attribute numbers for
* the attributes of this parent table. (They are not the same * the attributes of this parent table. (They are not the same
* for parents after the first one, nor if we have dropped * for parents after the first one, nor if we have dropped
* columns.) * columns.) +1 is to prevent error if parent has zero columns.
*/ */
newattno = (AttrNumber *) palloc(tupleDesc->natts * sizeof(AttrNumber)); newattno = (AttrNumber *)
palloc((tupleDesc->natts + 1) * sizeof(AttrNumber));
for (parent_attno = 1; parent_attno <= tupleDesc->natts; for (parent_attno = 1; parent_attno <= tupleDesc->natts;
parent_attno++) parent_attno++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment