mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Only allow heap in a number of contrib modules.
Contrib modules pgrowlocks, pgstattuple and some functionality in pageinspect currently only supports the heap table AM. As they are all concerned with low-level details that aren't reasonably exposed via tableam, error out if invoked on a non heap relation. Author: Andres Freund Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
This commit is contained in:
@ -30,6 +30,7 @@
|
||||
#include "access/htup_details.h"
|
||||
#include "access/relation.h"
|
||||
#include "funcapi.h"
|
||||
#include "catalog/pg_am_d.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "miscadmin.h"
|
||||
#include "utils/array.h"
|
||||
@ -318,6 +319,10 @@ tuple_data_split_internal(Oid relid, char *tupdata,
|
||||
raw_attrs = initArrayResult(BYTEAOID, CurrentMemoryContext, false);
|
||||
nattrs = tupdesc->natts;
|
||||
|
||||
if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("only heap AM is supported")));
|
||||
|
||||
if (nattrs < (t_infomask2 & HEAP_NATTS_MASK))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||
|
Reference in New Issue
Block a user