Let ALTER TABLE Phase 2 routines manage the relation pointer
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 25 Mar 2021 18:56:11 +0000 (15:56 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 25 Mar 2021 18:56:11 +0000 (15:56 -0300)
commitcd03c6e94b09ff402cbc3ce8da5587f09f0b5e58
tree8cd6585b3e3de9c5af2c9f3305b90db47b229f40
parent4669cacbd4b4b1baa1b7f2ea53d461433a1b6276
Let ALTER TABLE Phase 2 routines manage the relation pointer

Struct AlteredRelationInfo gains a new Relation member, to be used only
by Phase 2 (ATRewriteCatalogs); this allows ATExecCmd() subroutines open
and close the relation internally.

A future commit will use this facility to implement an ALTER TABLE
subcommand that closes and reopens the relation across transaction
boundaries.

(It is possible to keep the relation open past phase 2 to be used by
phase 3 instead of having to reopen it that point, but there are some
minor complications with that; it's not clear that there is much to be
won from doing that, though.)

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/20200803234854.GA24158@alvherre.pgsql
src/backend/commands/tablecmds.c