78 bool check,
Oid OIDOldToast)
103 if (rel->
rd_rel->relkind != RELKIND_RELATION &&
104 rel->
rd_rel->relkind != RELKIND_MATVIEW)
105 elog(
ERROR,
"\"%s\" is not a table or materialized view",
111 elog(
ERROR,
"\"%s\" does not require a toast table",
133 bool shared_relation;
134 bool mapped_relation;
192 elog(
ERROR,
"AccessExclusiveLock required to add toast table.");
197 snprintf(toast_relname,
sizeof(toast_relname),
198 "pg_toast_%u", relOid);
199 snprintf(toast_idxname,
sizeof(toast_idxname),
200 "pg_toast_%u_index", relOid);
238 namespaceid = PG_TOAST_NAMESPACE;
241 shared_relation = rel->
rd_rel->relisshared;
248 rel->
rd_rel->reltablespace,
257 rel->
rd_rel->relpersistence,
307 indexInfo->
ii_Am = BTREE_AM_OID;
314 opclassIds[0] = OID_BTREE_OPS_OID;
315 opclassIds[1] = INT4_BTREE_OPS_OID;
325 rel->
rd_rel->reltablespace,
326 collationIds, opclassIds, NULL, coloptions, NULL, (
Datum) 0,
338 elog(
ERROR,
"cache lookup failed for relation %u", relOid);
363 baseobject.
classId = RelationRelationId;
366 toastobject.
classId = RelationRelationId;
390 if (rel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
#define Assert(condition)
#define OidIsValid(objectId)
bool IsCatalogRelation(Relation relation)
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 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)
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)
#define TupleDescAttr(tupdesc, i)
void CommandCounterIncrement(void)