81 bool check,
Oid OIDOldToast)
106 if (rel->
rd_rel->relkind != RELKIND_RELATION &&
107 rel->
rd_rel->relkind != RELKIND_MATVIEW)
108 elog(
ERROR,
"\"%s\" is not a table or materialized view",
114 elog(
ERROR,
"\"%s\" does not require a toast table",
136 bool shared_relation;
137 bool mapped_relation;
195 elog(
ERROR,
"AccessExclusiveLock required to add toast table.");
200 snprintf(toast_relname,
sizeof(toast_relname),
201 "pg_toast_%u", relOid);
202 snprintf(toast_idxname,
sizeof(toast_idxname),
203 "pg_toast_%u_index", relOid);
241 namespaceid = PG_TOAST_NAMESPACE;
244 shared_relation = rel->
rd_rel->relisshared;
251 rel->
rd_rel->reltablespace,
260 rel->
rd_rel->relpersistence,
311 indexInfo->
ii_Am = BTREE_AM_OID;
318 opclassIds[0] = OID_BTREE_OPS_OID;
319 opclassIds[1] = INT4_BTREE_OPS_OID;
329 rel->
rd_rel->reltablespace,
330 collationIds, opclassIds, coloptions, (
Datum) 0,
342 elog(
ERROR,
"cache lookup failed for relation %u", relOid);
367 baseobject.
classId = RelationRelationId;
370 toastobject.
classId = RelationRelationId;
394 if (rel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
#define OidIsValid(objectId)
bool IsCatalogRelation(Relation relation)
elog(ERROR, "%s: %s", p2, msg)
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_inplace_update(Relation relation, HeapTuple tuple)
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 int16 *coloptions, 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)
Assert(fmt[strlen(fmt) - 1] !='\n')
#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)
uint16 * ii_ExclusionStrats
Datum * ii_OpclassOptions
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)
#define TupleDescAttr(tupdesc, i)
void CommandCounterIncrement(void)