32#include "utils/fmgroids.h"
79 bool check,
Oid OIDOldToast)
104 if (rel->
rd_rel->relkind != RELKIND_RELATION &&
105 rel->
rd_rel->relkind != RELKIND_MATVIEW)
106 elog(
ERROR,
"\"%s\" is not a table or materialized view",
112 elog(
ERROR,
"\"%s\" does not require a toast table",
134 bool shared_relation;
135 bool mapped_relation;
193 elog(
ERROR,
"AccessExclusiveLock required to add toast table.");
198 snprintf(toast_relname,
sizeof(toast_relname),
199 "pg_toast_%u", relOid);
200 snprintf(toast_idxname,
sizeof(toast_idxname),
201 "pg_toast_%u_index", relOid);
239 namespaceid = PG_TOAST_NAMESPACE;
242 shared_relation = rel->
rd_rel->relisshared;
249 rel->
rd_rel->reltablespace,
258 rel->
rd_rel->relpersistence,
308 indexInfo->
ii_Am = BTREE_AM_OID;
315 opclassIds[0] = OID_BTREE_OPS_OID;
316 opclassIds[1] = INT4_BTREE_OPS_OID;
326 rel->
rd_rel->reltablespace,
327 collationIds, opclassIds, NULL, coloptions, NULL, (
Datum) 0,
342 elog(
ERROR,
"cache lookup failed for relation %u", relOid);
362 elog(
ERROR,
"cache lookup failed for relation %u", relOid);
379 baseobject.
classId = RelationRelationId;
382 toastobject.
classId = RelationRelationId;
406 if (rel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
#define Assert(condition)
#define OidIsValid(objectId)
bool IsCatalogRelation(Relation relation)
void systable_inplace_update_begin(Relation relation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, const ScanKeyData *key, HeapTuple *oldtupcopy, void **state)
void systable_inplace_update_finish(void *state, HeapTuple tuple)
Oid heap_create_with_catalog(const char *relname, Oid relnamespace, Oid reltablespace, Oid relid, Oid reltypeid, Oid reloftypeid, Oid ownerid, Oid accessmtd, TupleDesc tupdesc, List *cooked_constraints, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, OnCommitAction oncommit, Datum reloptions, bool use_user_acl, bool allow_system_table_mods, bool is_internal, Oid relrewrite, ObjectAddress *typaddress)
Oid binary_upgrade_next_toast_pg_class_oid
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
Oid index_create(Relation heapRelation, const char *indexRelationName, Oid indexRelationId, Oid parentIndexRelid, Oid parentConstraintId, RelFileNumber relFileNumber, IndexInfo *indexInfo, const List *indexColNames, Oid accessMethodId, Oid tableSpaceId, const Oid *collationIds, const Oid *opclassIds, const Datum *opclassOptions, const int16 *coloptions, const NullableDatum *stattargets, Datum reloptions, bits16 flags, bits16 constr_flags, bool allow_system_table_mods, bool is_internal, Oid *constraintId)
#define INDEX_CREATE_IS_PRIMARY
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
#define AccessExclusiveLock
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
MemoryContext CurrentMemoryContext
#define IsBootstrapProcessingMode()
bool isTempOrTempToastNamespace(Oid namespaceId)
Oid GetTempToastNamespace(void)
FormData_pg_class * Form_pg_class
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
#define list_make2(x1, x2)
static Datum ObjectIdGetDatum(Oid X)
#define RelationGetRelid(relation)
#define RelationIsMapped(relation)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define BTEqualStrategyNumber
uint16 * ii_ExclusionStrats
ExprState * ii_PredicateState
List * ii_ExpressionsState
AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS]
#define SearchSysCacheCopy1(cacheId, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
static bool table_relation_needs_toast_table(Relation rel)
static Oid table_relation_toast_am(Relation rel)
#define InvalidCompressionMethod
void BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid)
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check, Oid OIDOldToast)
void NewHeapCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, Oid OIDOldToast)
void NewRelationCreateToastTable(Oid relOid, Datum reloptions)
void AlterTableCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode)
static bool create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptions, LOCKMODE lockmode, bool check, Oid OIDOldToast)
static bool needs_toast_table(Relation rel)
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
void CommandCounterIncrement(void)