public inbox for [email protected]
help / color / mirror / Atom feedFrom: Michael Paquier <[email protected]>
To: Justin Pryzby <[email protected]>
Cc: Soumyadeep Chakraborty <[email protected]>
Cc: Zhihong Yu <[email protected]>
Cc: [email protected]
Cc: Ashwin Agrawal <[email protected]>
Cc: [email protected]
Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Date: Thu, 1 Jun 2023 08:50:50 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<ZCJuW3GOfE/[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
On Wed, May 31, 2023 at 06:35:34PM -0500, Justin Pryzby wrote:
> What do you think the comment ought to say ? It already says:
>
> src/backend/catalog/heap.c- * Make a dependency link to force the relation to be deleted if its
> src/backend/catalog/heap.c- * access method is.
This is the third location where we rely on the fact that
RELKIND_HAS_TABLE_AM() does not include RELKIND_PARTITIONED_TABLE, so
it seems worth documenting what we are relying on as a comment? Say:
* Make a dependency link to force the relation to be deleted if its
* access method is.
*
* No need to add an explicit dependency for the toast table, as the
* main table depends on it. Partitioned tables have a table access
* method defined, and RELKIND_HAS_TABLE_AM ignores them.
>> Speaking of which, ATExecSetAccessMethodNoStorage() does a catalog
>> update even if ALTER TABLE is defined to use the same table AM as what
>> is currently set. There is no need to update the relation's pg_class
>> entry in this case. Be careful that InvokeObjectPostAlterHook() still
>> needs to be checked in this case. Perhaps some tests should be added
>> in test_oat_hooks.sql? It would be tempted to add a new SQL file for
>> that.
>
> Are you suggesting to put this in a conditional: if oldrelam!=newAccessMethod ?
Yes, that's what I would add with a few lines close to the beginning
of ATExecSetTableSpaceNoStorage() to save from catalog updates if
these are not needed.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../[email protected]/2-signature.asc)
download
view thread (32+ messages) latest in thread
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox