public inbox for [email protected]  
help / color / mirror / Atom feed
From: Zhihong Yu <[email protected]>
To: PostgreSQL Developers <[email protected]>
Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Date: Wed, 18 May 2022 16:02:51 -0700
Message-ID: <CALNJ-vRmfE2qTWS8wzm9B0_pVN1WiN=T1KKsakBLsCcw5-9cXw@mail.gmail.com> (raw)

Hi,

+       tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
+       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);

Shouldn't the validity of tup be checked before relam field is accessed ?

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]
  Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
  In-Reply-To: <CALNJ-vRmfE2qTWS8wzm9B0_pVN1WiN=T1KKsakBLsCcw5-9cXw@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