Skip to content

Commit cc121d5

Browse files
committed
Add comments for AlteredTableInfo->rel
The prior commit which introduced it was pretty squalid in terms of code documentation, so add some comments.
1 parent cd03c6e commit cc121d5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/backend/commands/tablecmds.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,16 @@ typedef struct AlteredTableInfo
157157
Oid relid; /* Relation to work on */
158158
char relkind; /* Its relkind */
159159
TupleDesc oldDesc; /* 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+
*/
161168
Relation rel;
169+
162170
/* Information saved by Phase 1 for Phase 2: */
163171
List *subcmds[AT_NUM_PASSES]; /* Lists of AlterTableCmd */
164172
/* Information saved by Phases 1/2 for Phase 3: */
@@ -4577,7 +4585,9 @@ ATRewriteCatalogs(List **wqueue, LOCKMODE lockmode,
45774585
continue;
45784586

45794587
/*
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.
45814591
*/
45824592
tab->rel = relation_open(tab->relid, NoLock);
45834593

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy