public inbox for [email protected]  
help / color / mirror / Atom feed
From: Zhihong Yu <[email protected]>
To: Soumyadeep Chakraborty <[email protected]>
Cc: Justin Pryzby <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Ashwin Agrawal <[email protected]>
Cc: [email protected]
Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Date: Wed, 18 May 2022 18:31:46 -0700
Message-ID: <CALNJ-vRWNh87w0jHEep6zzB3rxJWe_TEm-YrJsixTOZ0PyTOdQ@mail.gmail.com> (raw)
In-Reply-To: <CAE-ML+_2dfVcxqxNOWooCLLLFRwaSda3_7uXXwsiXZNsh5TZyA@mail.gmail.com>
References: <CAE-ML+9zM4wJCGCBGv01k96qQ3gFv4WFcFy=zqPHKeaEFwwv6A@mail.gmail.com>
	<[email protected]>
	<CAE-ML+_2dfVcxqxNOWooCLLLFRwaSda3_7uXXwsiXZNsh5TZyA@mail.gmail.com>

On Wed, May 18, 2022 at 5:49 PM Soumyadeep Chakraborty <
[email protected]> wrote:

>
> On Wed, May 18, 2022 at 4:14 PM Justin Pryzby <[email protected]>
> wrote:
>
> > I didn't look closely yet, but this comment is wrong:
> >
> > + * Since these have no storage the tablespace can be updated with a
> simple
>
>
> > + * metadata only operation to update the tablespace.
>
>
>
>
> Good catch. Fixed.
>
> > It'd be convenient if AMs worked the same way (and a bit odd that they
> don't).
> > Note that in v15, pg_dump/restore now allow --no-table-am, an exact
> parallel to
> > --no-tablespace.
>
> I agree that ATSET AM should behave in a similar fashion to ATSET
> tablespaces.
> However, the way that ATSET tablespace currently behaves is not consistent
> with
> the ONLY clause.
>
> On a given partition root:
> ALTER TABLE ONLY am_partitioned SET TABLESPACE ts;
> has the same effect as:
> ALTER TABLE am_partitioned SET TABLESPACE ts;
>
> We are missing out on the feature to set the AM/tablespace throughout the
> partition hierarchy, with one command.
>
> Regards,
> Soumyadeep (VMware)
>
> Hi,

+       accessMethodId = ((Form_pg_class) GETSTRUCT(tup))->relam;

-   /* look up the access method, verify it is for a table */
-   if (accessMethod != NULL)
-       accessMethodId = get_table_am_oid(accessMethod, false);
+       if (!HeapTupleIsValid(tup))
+           elog(ERROR, "cache lookup failed for relation %u", relid);

The validity check of tup should be done before fetching the value of
relam field.

Cheers


view thread (7+ 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: <CALNJ-vRWNh87w0jHEep6zzB3rxJWe_TEm-YrJsixTOZ0PyTOdQ@mail.gmail.com>

* 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