Re: ALTER TABLE SET ACCESS METHOD on partitioned tables - Mailing list pgsql-hackers

From Zhihong Yu
Subject Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Date
Msg-id CALNJ-vRmfE2qTWS8wzm9B0_pVN1WiN=T1KKsakBLsCcw5-9cXw@mail.gmail.com
Whole thread Raw
In response to ALTER TABLE SET ACCESS METHOD on partitioned tables  (Soumyadeep Chakraborty <soumyadeep2007@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)
Next
From: Justin Pryzby
Date:
Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables