1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-11 00:12:06 +03:00

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

This commit is contained in:
Tom Lane
2003-04-21 15:20:02 +00:00
parent 9ccfbe254a
commit a72fd0d60e

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.51.2.1 2002/12/16 18:39:56 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.51.2.2 2003/04/21 15:20:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -576,9 +576,10 @@ MergeAttributes(List *schema, List *supers, bool istemp,
* 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.)
* 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;
parent_attno++)