pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHO
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHO
@ 2023-06-29 22:50  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2023-06-29 22:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHOD

ALTER TABLE .. SET ACCESS METHOD was not registering a dependency to the
new access method with the relation altered in its rewrite phase, making
possible the drop of an access method even if there are relations that
depend on it.  During the rewrite, a temporary relation is created to
build the new relation files before swapping the new and old files, and,
while the temporary relation was registering a correct dependency to the
new AM, the old relation did not do that.  A dependency on the access
method is added when the relation files are swapped, which is the point
where pg_class is updated.

Materialized views and tables use the same code path, hence both were
impacted.

Backpatch down to 15, where this command has been introduced.

Reported-by: Alexander Lakhin
Reviewed-by: Nathan Bossart, Andres Freund
Discussion: https://postgr.es/m/18000-9145c25b1af475ca@postgresql.org
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/93401ec02f40dd85dd98147b883b158ebf5648c9

Modified Files
--------------
src/backend/commands/cluster.c          | 29 +++++++++++++++++++++++++++++
src/test/regress/expected/create_am.out | 29 +++++++++++++++++++++++++++++
src/test/regress/sql/create_am.sql      | 18 ++++++++++++++++++
3 files changed, 76 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHO
@ 2023-06-29 22:50  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2023-06-29 22:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHOD

ALTER TABLE .. SET ACCESS METHOD was not registering a dependency to the
new access method with the relation altered in its rewrite phase, making
possible the drop of an access method even if there are relations that
depend on it.  During the rewrite, a temporary relation is created to
build the new relation files before swapping the new and old files, and,
while the temporary relation was registering a correct dependency to the
new AM, the old relation did not do that.  A dependency on the access
method is added when the relation files are swapped, which is the point
where pg_class is updated.

Materialized views and tables use the same code path, hence both were
impacted.

Backpatch down to 15, where this command has been introduced.

Reported-by: Alexander Lakhin
Reviewed-by: Nathan Bossart, Andres Freund
Discussion: https://postgr.es/m/18000-9145c25b1af475ca@postgresql.org
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/97d89101045fac8cb36f4ef6c08526ea0841a596

Modified Files
--------------
src/backend/commands/cluster.c          | 29 +++++++++++++++++++++++++++++
src/test/regress/expected/create_am.out | 29 +++++++++++++++++++++++++++++
src/test/regress/sql/create_am.sql      | 18 ++++++++++++++++++
3 files changed, 76 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-06-29 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 22:50 pgsql: Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHO Michael Paquier <michael@paquier.xyz>
2023-06-29 22:50 pgsql: Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHO Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox