Re: ALTER TABLE SET ACCESS METHOD on partitioned tables

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Date: 2022-05-18 23:02:51
Message-ID: CALNJ-vRmfE2qTWS8wzm9B0_pVN1WiN=T1KKsakBLsCcw5-9cXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-05-18 23:14:14 Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Previous Message David Rowley 2022-05-18 22:57:02 Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)