@@ -157,8 +157,16 @@ typedef struct AlteredTableInfo
157
157
Oidrelid;/* Relation to work on */
158
158
charrelkind;/* Its relkind */
159
159
TupleDescoldDesc;/* Pre-modification tuple descriptor */
160
- /* Transiently set during Phase 2, normally set to NULL */
160
+
161
+ /*
162
+ * Transiently set during Phase 2, normally set to NULL.
163
+ *
164
+ * ATRewriteCatalogs sets this when it starts, and closes when ATExecCmd
165
+ * returns control. This can be exploited by ATExecCmd subroutines to
166
+ * close/reopen across transaction boundaries.
167
+ */
161
168
Relationrel;
169
+
162
170
/* Information saved by Phase 1 for Phase 2: */
163
171
List *subcmds[AT_NUM_PASSES]; /* Lists of AlterTableCmd */
164
172
/* Information saved by Phases 1/2 for Phase 3: */
@@ -4577,7 +4585,9 @@ ATRewriteCatalogs(List **wqueue, LOCKMODE lockmode,
4577
4585
continue;
4578
4586
4579
4587
/*
4580
- * Appropriate lock was obtained by phase 1, needn't get it again
4588
+ * Open the relation and store it in tab. This allows subroutines
4589
+ * close and reopen, if necessary. Appropriate lock was obtained
4590
+ * by phase 1, needn't get it again.
4581
4591
*/
4582
4592
tab->rel = relation_open(tab->relid, NoLock);
4583
4593