diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-04-21 15:19:55 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-04-21 15:19:55 +0000 |
commit | ca944bd2d41814712cb4a4810ab4aa490f23a853 (patch) | |
tree | 28fe44a82b3985a6f744aa87a5568087b381cf44 /src | |
parent | 185ad7a8398460298b80219393ba55b6b481e2ae (diff) | |
download | postgresql-ca944bd2d41814712cb4a4810ab4aa490f23a853.tar.gz postgresql-ca944bd2d41814712cb4a4810ab4aa490f23a853.zip |
Prevent palloc(0) error when parent table has zero columns.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/tablecmds.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index e22b48aef29..b4576893c66 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * 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, * 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++) |