Hi Ashutosh
I stumbled upon this thread today, went through your patch and it looks good. A minor suggestion in
sanity_check_relation():
if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));
Instead of checking the access method OID, it seems better to check the handler OID like so:
if (rel->rd_amhandler != HEAP_TABLE_AM_HANDLER_OID)
The reason is current version of sanity_check_relation() would emit error for the following case even when the table
structureis actually heap.
create access method myam type table handler heap_tableam_handler;
create table mytable (…) using myam;
Asim