pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix dependency of partitioned table and table AM with CREATE TAB
Date: Mon, 28 Oct 2024 23:42:29 +0000
Message-ID: <E1t5ZNW-002usy-1i@gemulon.postgresql.org> (raw)

Fix dependency of partitioned table and table AM with CREATE TABLE .. USING

A pg_depend entry between a partitioned table and its table access
method was missing when using CREATE TABLE .. USING with an unpinned
access method.  DROP ACCESS METHOD could be used, while it should be
blocked if CASCADE is not specified, even if there was a partitioned
table that depends on the table access method.  pg_class.relam would
then hold an orphaned OID value still pointing to the AM dropped.

The problem is fixed by adding a dependency between the partitioned
table and its table access method if set when the relation is created.
A test checking the contents of pg_depend in this case is added.

Issue introduced in 374c7a229042, that has added support for CREATE
TABLE .. USING for partitioned tables.

Reviewed-by: Alexander Lakhin
Discussion: https://postgr.es/m/18674-1ef01eceec278fab@postgresql.org
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/49a23441ca7f314c25794a9a547011c0a858cfaa

Modified Files
--------------
src/backend/catalog/heap.c              |  6 ++++--
src/test/regress/expected/create_am.out | 14 ++++++++++++++
src/test/regress/sql/create_am.sql      | 10 ++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)



view thread (2+ messages)

Message-ID: <E1t5ZNW-002usy-1i@gemulon.postgresql.org>
Permalink:  ../E1t5ZNW-002usy-1i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1t5ZNW-002usy-1i@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix dependency of partitioned table and table AM with CREATE TAB
  In-Reply-To: <E1t5ZNW-002usy-1i@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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