diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2021-03-25 16:07:15 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2021-03-25 16:07:15 -0300 |
commit | cc121d5596964f8aac93607e6f14607184558b16 (patch) | |
tree | 0df22e90446f77703cc7efacdf281a9509b67bec /src/backend/commands/tablecmds.c | |
parent | cd03c6e94b09ff402cbc3ce8da5587f09f0b5e58 (diff) | |
download | postgresql-cc121d5596964f8aac93607e6f14607184558b16.tar.gz postgresql-cc121d5596964f8aac93607e6f14607184558b16.zip |
Add comments for AlteredTableInfo->rel
The prior commit which introduced it was pretty squalid in terms of
code documentation, so add some comments.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index bf7fd6e8ae6..550b84681e4 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -157,8 +157,16 @@ typedef struct AlteredTableInfo Oid relid; /* Relation to work on */ char relkind; /* Its relkind */ TupleDesc oldDesc; /* Pre-modification tuple descriptor */ - /* Transiently set during Phase 2, normally set to NULL */ + + /* + * Transiently set during Phase 2, normally set to NULL. + * + * ATRewriteCatalogs sets this when it starts, and closes when ATExecCmd + * returns control. This can be exploited by ATExecCmd subroutines to + * close/reopen across transaction boundaries. + */ Relation rel; + /* Information saved by Phase 1 for Phase 2: */ List *subcmds[AT_NUM_PASSES]; /* Lists of AlterTableCmd */ /* Information saved by Phases 1/2 for Phase 3: */ @@ -4577,7 +4585,9 @@ ATRewriteCatalogs(List **wqueue, LOCKMODE lockmode, continue; /* - * Appropriate lock was obtained by phase 1, needn't get it again + * Open the relation and store it in tab. This allows subroutines + * close and reopen, if necessary. Appropriate lock was obtained + * by phase 1, needn't get it again. */ tab->rel = relation_open(tab->relid, NoLock); |