|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.106 2004/05/0800:34:49 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.107 2004/05/0822:46:29 tgl Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -112,6 +112,7 @@ typedef struct AlteredTableInfo |
112 | 112 | { |
113 | 113 | /* Information saved before any work commences: */ |
114 | 114 | Oidrelid;/* Relation to work on */ |
| 115 | +charrelkind;/* Its relkind */ |
115 | 116 | TupleDescoldDesc;/* Pre-modification tuple descriptor */ |
116 | 117 | /* Information saved by Phase 1 for Phase 2: */ |
117 | 118 | List*subcmds[AT_NUM_PASSES];/* Lists of AlterTableCmd */ |
@@ -2011,9 +2012,10 @@ ATRewriteCatalogs(List **wqueue) |
2011 | 2012 | { |
2012 | 2013 | AlteredTableInfo*tab= (AlteredTableInfo*)lfirst(ltab); |
2013 | 2014 |
|
2014 | | -if (tab->subcmds[AT_PASS_ADD_COL]|| |
2015 | | -tab->subcmds[AT_PASS_ALTER_TYPE]|| |
2016 | | -tab->subcmds[AT_PASS_COL_ATTRS]) |
| 2015 | +if (tab->relkind==RELKIND_RELATION&& |
| 2016 | +(tab->subcmds[AT_PASS_ADD_COL]|| |
| 2017 | +tab->subcmds[AT_PASS_ALTER_TYPE]|| |
| 2018 | +tab->subcmds[AT_PASS_COL_ATTRS])) |
2017 | 2019 | { |
2018 | 2020 | AlterTableCreateToastTable(tab->relid, true); |
2019 | 2021 | } |
@@ -2192,7 +2194,7 @@ ATRewriteTables(List **wqueue) |
2192 | 2194 | */ |
2193 | 2195 | reindex_relation(tab->relid, false); |
2194 | 2196 | } |
2195 | | -else |
| 2197 | +elseif (tab->constraints!=NIL) |
2196 | 2198 | { |
2197 | 2199 | /* |
2198 | 2200 | * Test the current data within the table against new constraints |
@@ -2486,6 +2488,7 @@ ATGetQueueEntry(List **wqueue, Relation rel) |
2486 | 2488 | */ |
2487 | 2489 | tab= (AlteredTableInfo*)palloc0(sizeof(AlteredTableInfo)); |
2488 | 2490 | tab->relid=relid; |
| 2491 | +tab->relkind=rel->rd_rel->relkind; |
2489 | 2492 | tab->oldDesc=CreateTupleDescCopy(RelationGetDescr(rel)); |
2490 | 2493 |
|
2491 | 2494 | *wqueue=lappend(*wqueue,tab); |
|