Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitca944bd

Browse files
committed
Prevent palloc(0) error when parent table has zero columns.
1 parent185ad7a commitca944bd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.70 2003/03/21 15:43:02 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.71 2003/04/21 15:19:55 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -591,9 +591,10 @@ MergeAttributes(List *schema, List *supers, bool istemp,
591591
* newattno[] will contain the child-table attribute numbers for
592592
* the attributes of this parent table. (They are not the same
593593
* for parents after the first one, nor if we have dropped
594-
* columns.)
594+
* columns.) +1 is to prevent error if parent has zero columns.
595595
*/
596-
newattno= (AttrNumber*)palloc(tupleDesc->natts*sizeof(AttrNumber));
596+
newattno= (AttrNumber*)
597+
palloc((tupleDesc->natts+1)*sizeof(AttrNumber));
597598

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp