summaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/adt/acl.c5
-rw-r--r--src/backend/utils/adt/datetime.c4
-rw-r--r--src/backend/utils/adt/enum.c13
-rw-r--r--src/backend/utils/adt/expandedrecord.c8
-rw-r--r--src/backend/utils/adt/genfile.c4
-rw-r--r--src/backend/utils/adt/lockfuncs.c2
-rw-r--r--src/backend/utils/adt/misc.c2
-rw-r--r--src/backend/utils/adt/orderedsetaggs.c4
-rw-r--r--src/backend/utils/adt/partitionfuncs.c2
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c2
-rw-r--r--src/backend/utils/adt/ruleutils.c9
-rw-r--r--src/backend/utils/adt/selfuncs.c1
-rw-r--r--src/backend/utils/adt/trigfuncs.c11
-rw-r--r--src/backend/utils/adt/tsvector_op.c4
-rw-r--r--src/backend/utils/cache/catcache.c86
-rw-r--r--src/backend/utils/cache/inval.c4
-rw-r--r--src/backend/utils/cache/lsyscache.c4
-rw-r--r--src/backend/utils/cache/plancache.c4
-rw-r--r--src/backend/utils/cache/relcache.c125
-rw-r--r--src/backend/utils/cache/relfilenodemap.c22
-rw-r--r--src/backend/utils/cache/syscache.c71
-rw-r--r--src/backend/utils/cache/typcache.c2
-rw-r--r--src/backend/utils/fmgr/fmgr.c4
-rw-r--r--src/backend/utils/fmgr/funcapi.c4
-rw-r--r--src/backend/utils/init/miscinit.c2
-rw-r--r--src/backend/utils/init/postinit.c8
-rw-r--r--src/backend/utils/misc/guc.c22
-rw-r--r--src/backend/utils/misc/pg_controldata.c8
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample1
-rw-r--r--src/backend/utils/mmgr/portalmem.c2
30 files changed, 159 insertions, 281 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index c5f7918440..30cf3d0b11 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -1763,7 +1763,7 @@ aclexplode(PG_FUNCTION_ARGS)
* build tupdesc for result tuples (matches out parameters in pg_proc
* entry)
*/
- tupdesc = CreateTemplateTupleDesc(4, false);
+ tupdesc = CreateTemplateTupleDesc(4);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "grantor",
OIDOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "grantee",
@@ -5191,7 +5191,8 @@ get_role_oid(const char *rolname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid1(AUTHNAME, CStringGetDatum(rolname));
+ oid = GetSysCacheOid1(AUTHNAME, Anum_pg_authid_oid,
+ CStringGetDatum(rolname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 20d6cee8b1..cd5fd0a099 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4674,7 +4674,7 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS)
* build tupdesc for result tuples. This must match this function's
* pg_proc entry!
*/
- tupdesc = CreateTemplateTupleDesc(3, false);
+ tupdesc = CreateTemplateTupleDesc(3);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "abbrev",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "utc_offset",
@@ -4801,7 +4801,7 @@ pg_timezone_names(PG_FUNCTION_ARGS)
* build tupdesc for result tuples. This must match this function's
* pg_proc entry!
*/
- tupdesc = CreateTemplateTupleDesc(4, false);
+ tupdesc = CreateTemplateTupleDesc(4);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "abbrev",
diff --git a/src/backend/utils/adt/enum.c b/src/backend/utils/adt/enum.c
index 01edccced2..99f0a90248 100644
--- a/src/backend/utils/adt/enum.c
+++ b/src/backend/utils/adt/enum.c
@@ -64,7 +64,7 @@ static void
check_safe_enum_use(HeapTuple enumval_tup)
{
TransactionId xmin;
- Form_pg_enum en;
+ Form_pg_enum en = (Form_pg_enum) GETSTRUCT(enumval_tup);
/*
* If the row is hinted as committed, it's surely safe. This provides a
@@ -88,14 +88,13 @@ check_safe_enum_use(HeapTuple enumval_tup)
* owning type. (This'd also be false for values made by other
* transactions; but the previous tests should have handled all of those.)
*/
- if (!EnumBlacklisted(HeapTupleGetOid(enumval_tup)))
+ if (!EnumBlacklisted(en->oid))
return;
/*
* There might well be other tests we could do here to narrow down the
* unsafe conditions, but for now just raise an exception.
*/
- en = (Form_pg_enum) GETSTRUCT(enumval_tup);
ereport(ERROR,
(errcode(ERRCODE_UNSAFE_NEW_ENUM_VALUE_USAGE),
errmsg("unsafe use of new value \"%s\" of enum type %s",
@@ -140,7 +139,7 @@ enum_in(PG_FUNCTION_ARGS)
* This comes from pg_enum.oid and stores system oids in user tables. This
* oid must be preserved by binary upgrades.
*/
- enumoid = HeapTupleGetOid(tup);
+ enumoid = ((Form_pg_enum) GETSTRUCT(tup))->oid;
ReleaseSysCache(tup);
@@ -204,7 +203,7 @@ enum_recv(PG_FUNCTION_ARGS)
/* check it's safe to use in SQL */
check_safe_enum_use(tup);
- enumoid = HeapTupleGetOid(tup);
+ enumoid = ((Form_pg_enum) GETSTRUCT(tup))->oid;
ReleaseSysCache(tup);
@@ -414,7 +413,7 @@ enum_endpoint(Oid enumtypoid, ScanDirection direction)
{
/* check it's safe to use in SQL */
check_safe_enum_use(enum_tuple);
- minmax = HeapTupleGetOid(enum_tuple);
+ minmax = ((Form_pg_enum) GETSTRUCT(enum_tuple))->oid;
}
else
{
@@ -574,7 +573,7 @@ enum_range_internal(Oid enumtypoid, Oid lower, Oid upper)
while (HeapTupleIsValid(enum_tuple = systable_getnext_ordered(enum_scan, ForwardScanDirection)))
{
- Oid enum_oid = HeapTupleGetOid(enum_tuple);
+ Oid enum_oid = ((Form_pg_enum) GETSTRUCT(enum_tuple))->oid;
if (!left_found && lower == enum_oid)
left_found = true;
diff --git a/src/backend/utils/adt/expandedrecord.c b/src/backend/utils/adt/expandedrecord.c
index 9aa6f3aac5..5561b741e9 100644
--- a/src/backend/utils/adt/expandedrecord.c
+++ b/src/backend/utils/adt/expandedrecord.c
@@ -741,9 +741,6 @@ ER_get_flat_size(ExpandedObjectHeader *eohptr)
if (hasnull)
len += BITMAPLEN(tupdesc->natts);
- if (tupdesc->tdhasoid)
- len += sizeof(Oid);
-
hoff = len = MAXALIGN(len); /* align user data safely */
data_len = heap_compute_data_size(tupdesc, erh->dvalues, erh->dnulls);
@@ -804,9 +801,6 @@ ER_flatten_into(ExpandedObjectHeader *eohptr,
HeapTupleHeaderSetNatts(tuphdr, tupdesc->natts);
tuphdr->t_hoff = erh->hoff;
- if (tupdesc->tdhasoid) /* else leave infomask = 0 */
- tuphdr->t_infomask = HEAP_HASOID;
-
/* And fill the data area from dvalues/dnulls */
heap_fill_tuple(tupdesc,
erh->dvalues,
@@ -1045,7 +1039,7 @@ expanded_record_lookup_field(ExpandedRecordHeader *erh, const char *fieldname,
}
/* How about system attributes? */
- sysattr = SystemAttributeByName(fieldname, tupdesc->tdhasoid);
+ sysattr = SystemAttributeByName(fieldname);
if (sysattr != NULL)
{
finfo->fnumber = sysattr->attnum;
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index d4dc92c2fd..5081a974c2 100644
--- a/src/backend/utils/adt/genfile.c
+++ b/src/backend/utils/adt/genfile.c
@@ -388,7 +388,7 @@ pg_stat_file(PG_FUNCTION_ARGS)
* This record type had better match the output parameters declared for me
* in pg_proc.h.
*/
- tupdesc = CreateTemplateTupleDesc(6, false);
+ tupdesc = CreateTemplateTupleDesc(6);
TupleDescInitEntry(tupdesc, (AttrNumber) 1,
"size", INT8OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2,
@@ -538,7 +538,7 @@ pg_ls_dir_files(FunctionCallInfo fcinfo, const char *dir, bool missing_ok)
fctx = palloc(sizeof(directory_fctx));
- tupdesc = CreateTemplateTupleDesc(3, false);
+ tupdesc = CreateTemplateTupleDesc(3);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "size",
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index 66c09a1f31..525decb6f1 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -101,7 +101,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
/* build tupdesc for result tuples */
/* this had better match function's declaration in pg_proc.h */
- tupdesc = CreateTemplateTupleDesc(NUM_LOCK_STATUS_COLUMNS, false);
+ tupdesc = CreateTemplateTupleDesc(NUM_LOCK_STATUS_COLUMNS);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "locktype",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "database",
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 309eb2935c..d05849f1d4 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -402,7 +402,7 @@ pg_get_keywords(PG_FUNCTION_ARGS)
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
- tupdesc = CreateTemplateTupleDesc(3, false);
+ tupdesc = CreateTemplateTupleDesc(3);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "word",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "catcode",
diff --git a/src/backend/utils/adt/orderedsetaggs.c b/src/backend/utils/adt/orderedsetaggs.c
index 8871aed904..1b21da8d09 100644
--- a/src/backend/utils/adt/orderedsetaggs.c
+++ b/src/backend/utils/adt/orderedsetaggs.c
@@ -215,7 +215,7 @@ ordered_set_startup(FunctionCallInfo fcinfo, bool use_tuples)
* Get a tupledesc corresponding to the aggregated inputs
* (including sort expressions) of the agg.
*/
- qstate->tupdesc = ExecTypeFromTL(aggref->args, false);
+ qstate->tupdesc = ExecTypeFromTL(aggref->args);
/* If we need a flag column, hack the tupledesc to include that */
if (ishypothetical)
@@ -223,7 +223,7 @@ ordered_set_startup(FunctionCallInfo fcinfo, bool use_tuples)
TupleDesc newdesc;
int natts = qstate->tupdesc->natts;
- newdesc = CreateTemplateTupleDesc(natts + 1, false);
+ newdesc = CreateTemplateTupleDesc(natts + 1);
for (i = 1; i <= natts; i++)
TupleDescCopyEntry(newdesc, i, qstate->tupdesc, i);
diff --git a/src/backend/utils/adt/partitionfuncs.c b/src/backend/utils/adt/partitionfuncs.c
index 8f9218ad0a..78dd2b542b 100644
--- a/src/backend/utils/adt/partitionfuncs.c
+++ b/src/backend/utils/adt/partitionfuncs.c
@@ -72,7 +72,7 @@ pg_partition_tree(PG_FUNCTION_ARGS)
*/
partitions = find_all_inheritors(rootrelid, AccessShareLock, NULL);
- tupdesc = CreateTemplateTupleDesc(PG_PARTITION_TREE_COLS, false);
+ tupdesc = CreateTemplateTupleDesc(PG_PARTITION_TREE_COLS);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "relid",
REGCLASSOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "parentid",
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index e95e347184..f955f1912a 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -1829,7 +1829,7 @@ pg_stat_get_archiver(PG_FUNCTION_ARGS)
MemSet(nulls, 0, sizeof(nulls));
/* Initialise attributes information in the tuple descriptor */
- tupdesc = CreateTemplateTupleDesc(7, false);
+ tupdesc = CreateTemplateTupleDesc(7);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "archived_count",
INT8OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "last_archived_wal",
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 29884f1c8b..4857caecaa 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -843,7 +843,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
tgrel = heap_open(TriggerRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
- ObjectIdAttributeNumber,
+ Anum_pg_trigger_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(trigid));
@@ -1883,7 +1883,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
Relation relation = heap_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&scankey[0],
- ObjectIdAttributeNumber,
+ Anum_pg_constraint_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(constraintId));
@@ -2930,11 +2930,10 @@ print_function_arguments(StringInfo buf, HeapTuple proctup,
HeapTuple aggtup;
Form_pg_aggregate agg;
- aggtup = SearchSysCache1(AGGFNOID,
- ObjectIdGetDatum(HeapTupleGetOid(proctup)));
+ aggtup = SearchSysCache1(AGGFNOID, proc->oid);
if (!HeapTupleIsValid(aggtup))
elog(ERROR, "cache lookup failed for aggregate %u",
- HeapTupleGetOid(proctup));
+ proc->oid);
agg = (Form_pg_aggregate) GETSTRUCT(aggtup);
if (AGGKIND_IS_ORDERED_SET(agg->aggkind))
insertorderbyat = agg->aggnumdirectargs;
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index dbbbcc979b..73fbb4ac86 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -5216,7 +5216,6 @@ get_variable_numdistinct(VariableStatData *vardata, bool *isdefault)
{
switch (((Var *) vardata->var)->varattno)
{
- case ObjectIdAttributeNumber:
case SelfItemPointerAttributeNumber:
stadistinct = -1.0; /* unique (and all non null) */
break;
diff --git a/src/backend/utils/adt/trigfuncs.c b/src/backend/utils/adt/trigfuncs.c
index 04605021d7..93ac936420 100644
--- a/src/backend/utils/adt/trigfuncs.c
+++ b/src/backend/utils/adt/trigfuncs.c
@@ -66,17 +66,6 @@ suppress_redundant_updates_trigger(PG_FUNCTION_ARGS)
newheader = newtuple->t_data;
oldheader = oldtuple->t_data;
- /*
- * We are called before the OID, if any, has been transcribed from the old
- * tuple to the new (in heap_update). To avoid a bogus compare failure,
- * copy the OID now. But check that someone didn't already put another
- * OID value into newtuple. (That's not actually possible at present, but
- * maybe someday.)
- */
- if (trigdata->tg_relation->rd_rel->relhasoids &&
- !OidIsValid(HeapTupleHeaderGetOid(newheader)))
- HeapTupleHeaderSetOid(newheader, HeapTupleHeaderGetOid(oldheader));
-
/* if the tuple payload is the same ... */
if (newtuple->t_len == oldtuple->t_len &&
newheader->t_hoff == oldheader->t_hoff &&
diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c
index 258fe47a24..3c55166a14 100644
--- a/src/backend/utils/adt/tsvector_op.c
+++ b/src/backend/utils/adt/tsvector_op.c
@@ -646,7 +646,7 @@ tsvector_unnest(PG_FUNCTION_ARGS)
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
- tupdesc = CreateTemplateTupleDesc(3, false);
+ tupdesc = CreateTemplateTupleDesc(3);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "lexeme",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "positions",
@@ -2187,7 +2187,7 @@ ts_setup_firstcall(FunctionCallInfo fcinfo, FuncCallContext *funcctx,
}
Assert(stat->stackpos <= stat->maxdepth);
- tupdesc = CreateTemplateTupleDesc(3, false);
+ tupdesc = CreateTemplateTupleDesc(3);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "word",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "ndoc",
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 5ddbf6eab1..b31fd5acea 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -338,39 +338,31 @@ CatalogCacheComputeTupleHashValue(CatCache *cache, int nkeys, HeapTuple tuple)
switch (nkeys)
{
case 4:
- v4 = (cc_keyno[3] == ObjectIdAttributeNumber)
- ? ObjectIdGetDatum(HeapTupleGetOid(tuple))
- : fastgetattr(tuple,
- cc_keyno[3],
- cc_tupdesc,
- &isNull);
+ v4 = fastgetattr(tuple,
+ cc_keyno[3],
+ cc_tupdesc,
+ &isNull);
Assert(!isNull);
/* FALLTHROUGH */
case 3:
- v3 = (cc_keyno[2] == ObjectIdAttributeNumber)
- ? ObjectIdGetDatum(HeapTupleGetOid(tuple))
- : fastgetattr(tuple,
- cc_keyno[2],
- cc_tupdesc,
- &isNull);
+ v3 = fastgetattr(tuple,
+ cc_keyno[2],
+ cc_tupdesc,
+ &isNull);
Assert(!isNull);
/* FALLTHROUGH */
case 2:
- v2 = (cc_keyno[1] == ObjectIdAttributeNumber)
- ? ObjectIdGetDatum(HeapTupleGetOid(tuple))
- : fastgetattr(tuple,
- cc_keyno[1],
- cc_tupdesc,
- &isNull);
+ v2 = fastgetattr(tuple,
+ cc_keyno[1],
+ cc_tupdesc,
+ &isNull);
Assert(!isNull);
/* FALLTHROUGH */
case 1:
- v1 = (cc_keyno[0] == ObjectIdAttributeNumber)
- ? ObjectIdGetDatum(HeapTupleGetOid(tuple))
- : fastgetattr(tuple,
- cc_keyno[0],
- cc_tupdesc,
- &isNull);
+ v1 = fastgetattr(tuple,
+ cc_keyno[0],
+ cc_tupdesc,
+ &isNull);
Assert(!isNull);
break;
default:
@@ -998,8 +990,8 @@ CatalogCacheInitializeCache(CatCache *cache)
}
else
{
- if (cache->cc_keyno[i] != ObjectIdAttributeNumber)
- elog(FATAL, "only sys attr supported in caches is OID");
+ if (cache->cc_keyno[i] < 0)
+ elog(FATAL, "sys attributes are not supported in caches");
keytype = OIDOID;
}
@@ -1935,9 +1927,7 @@ CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, int *attnos, Datum *keys)
int attnum = attnos[i];
Form_pg_attribute att;
- /* only valid system attribute is the oid, which is by value */
- if (attnum == ObjectIdAttributeNumber)
- continue;
+ /* system attribute are not supported in caches */
Assert(attnum > 0);
att = TupleDescAttr(tupdesc, attnum - 1);
@@ -1966,33 +1956,25 @@ CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, int *attnos,
for (i = 0; i < nkeys; i++)
{
int attnum = attnos[i];
+ Form_pg_attribute att = TupleDescAttr(tupdesc, attnum - 1);
+ Datum src = srckeys[i];
+ NameData srcname;
- if (attnum == ObjectIdAttributeNumber)
+ /*
+ * Must be careful in case the caller passed a C string where a
+ * NAME is wanted: convert the given argument to a correctly
+ * padded NAME. Otherwise the memcpy() done by datumCopy() could
+ * fall off the end of memory.
+ */
+ if (att->atttypid == NAMEOID)
{
- dstkeys[i] = srckeys[i];
+ namestrcpy(&srcname, DatumGetCString(src));
+ src = NameGetDatum(&srcname);
}
- else
- {
- Form_pg_attribute att = TupleDescAttr(tupdesc, attnum - 1);
- Datum src = srckeys[i];
- NameData srcname;
- /*
- * Must be careful in case the caller passed a C string where a
- * NAME is wanted: convert the given argument to a correctly
- * padded NAME. Otherwise the memcpy() done by datumCopy() could
- * fall off the end of memory.
- */
- if (att->atttypid == NAMEOID)
- {
- namestrcpy(&srcname, DatumGetCString(src));
- src = NameGetDatum(&srcname);
- }
-
- dstkeys[i] = datumCopy(src,
- att->attbyval,
- att->attlen);
- }
+ dstkeys[i] = datumCopy(src,
+ att->attbyval,
+ att->attlen);
}
}
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index f3ded4def9..5157493795 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -1166,7 +1166,7 @@ CacheInvalidateHeapTuple(Relation relation,
{
Form_pg_class classtup = (Form_pg_class) GETSTRUCT(tuple);
- relationId = HeapTupleGetOid(tuple);
+ relationId = classtup->oid;
if (classtup->relisshared)
databaseId = InvalidOid;
else
@@ -1292,7 +1292,7 @@ CacheInvalidateRelcacheByTuple(HeapTuple classTuple)
PrepareInvalidationState();
- relationId = HeapTupleGetOid(classTuple);
+ relationId = classtup->oid;
if (classtup->relisshared)
databaseId = InvalidOid;
else
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 892ddc0d48..7a263cc1fd 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -1653,7 +1653,7 @@ get_func_rows(Oid funcid)
Oid
get_relname_relid(const char *relname, Oid relnamespace)
{
- return GetSysCacheOid2(RELNAMENSP,
+ return GetSysCacheOid2(RELNAMENSP, Anum_pg_class_oid,
PointerGetDatum(relname),
ObjectIdGetDatum(relnamespace));
}
@@ -2056,7 +2056,7 @@ getTypeIOParam(HeapTuple typeTuple)
if (OidIsValid(typeStruct->typelem))
return typeStruct->typelem;
else
- return HeapTupleGetOid(typeTuple);
+ return typeStruct->oid;
}
/*
diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c
index fc7e8dbe26..9ec81c5f36 100644
--- a/src/backend/utils/cache/plancache.c
+++ b/src/backend/utils/cache/plancache.c
@@ -1663,12 +1663,12 @@ PlanCacheComputeResultDesc(List *stmt_list)
case PORTAL_ONE_SELECT:
case PORTAL_ONE_MOD_WITH:
query = linitial_node(Query, stmt_list);
- return ExecCleanTypeFromTL(query->targetList, false);
+ return ExecCleanTypeFromTL(query->targetList);
case PORTAL_ONE_RETURNING:
query = QueryListGetPrimaryStmt(stmt_list);
Assert(query->returningList);
- return ExecCleanTypeFromTL(query->returningList, false);
+ return ExecCleanTypeFromTL(query->returningList);
case PORTAL_UTIL_SELECT:
query = linitial_node(Query, stmt_list);
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index aecbd4a943..c3071db1cd 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -261,8 +261,7 @@ static void write_relcache_init_file(bool shared);
static void write_item(const void *data, Size len, FILE *fp);
static void formrdesc(const char *relationName, Oid relationReltype,
- bool isshared, bool hasoids,
- int natts, const FormData_pg_attribute *attrs);
+ bool isshared, int natts, const FormData_pg_attribute *attrs);
static HeapTuple ScanPgRelation(Oid targetRelId, bool indexOK, bool force_non_historic);
static Relation AllocateRelationDesc(Form_pg_class relp);
@@ -328,7 +327,7 @@ ScanPgRelation(Oid targetRelId, bool indexOK, bool force_non_historic)
* form a scan key
*/
ScanKeyInit(&key[0],
- ObjectIdAttributeNumber,
+ Anum_pg_class_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(targetRelId));
@@ -414,8 +413,7 @@ AllocateRelationDesc(Form_pg_class relp)
relation->rd_rel = relationForm;
/* and allocate attribute tuple form storage */
- relation->rd_att = CreateTemplateTupleDesc(relationForm->relnatts,
- relationForm->relhasoids);
+ relation->rd_att = CreateTemplateTupleDesc(relationForm->relnatts);
/* which we mark as a reference-counted tupdesc */
relation->rd_att->tdrefcount = 1;
@@ -505,7 +503,6 @@ RelationBuildTupleDesc(Relation relation)
/* copy some fields from pg_class row to rd_att */
relation->rd_att->tdtypeid = relation->rd_rel->reltype;
relation->rd_att->tdtypmod = -1; /* unnecessary, but... */
- relation->rd_att->tdhasoid = relation->rd_rel->relhasoids;
constr = (TupleConstr *) MemoryContextAlloc(CacheMemoryContext,
sizeof(TupleConstr));
@@ -789,7 +786,7 @@ RelationBuildRuleLock(Relation relation)
rule = (RewriteRule *) MemoryContextAlloc(rulescxt,
sizeof(RewriteRule));
- rule->ruleId = HeapTupleGetOid(rewrite_tuple);
+ rule->ruleId = rewrite_form->oid;
rule->event = rewrite_form->ev_type - '0';
rule->enabled = rewrite_form->ev_enabled;
@@ -1090,8 +1087,8 @@ RelationBuildDesc(Oid targetRelId, bool insertIt)
/*
* get information from the pg_class_tuple
*/
- relid = HeapTupleGetOid(pg_class_tuple);
relp = (Form_pg_class) GETSTRUCT(pg_class_tuple);
+ relid = relp->oid;
Assert(relid == targetRelId);
/*
@@ -1641,7 +1638,7 @@ LookupOpclassInfo(Oid operatorClassOid,
* work while bootstrapping.
*/
ScanKeyInit(&skey[0],
- ObjectIdAttributeNumber,
+ Anum_pg_opclass_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(operatorClassOid));
rel = heap_open(OperatorClassRelationId, AccessShareLock);
@@ -1725,7 +1722,7 @@ LookupOpclassInfo(Oid operatorClassOid,
*/
static void
formrdesc(const char *relationName, Oid relationReltype,
- bool isshared, bool hasoids,
+ bool isshared,
int natts, const FormData_pg_attribute *attrs)
{
Relation relation;
@@ -1789,7 +1786,6 @@ formrdesc(const char *relationName, Oid relationReltype,
relation->rd_rel->reltuples = 0;
relation->rd_rel->relallvisible = 0;
relation->rd_rel->relkind = RELKIND_RELATION;
- relation->rd_rel->relhasoids = hasoids;
relation->rd_rel->relnatts = (int16) natts;
/*
@@ -1799,7 +1795,7 @@ formrdesc(const char *relationName, Oid relationReltype,
* because it will never be replaced. The data comes from
* src/include/catalog/ headers via genbki.pl.
*/
- relation->rd_att = CreateTemplateTupleDesc(natts, hasoids);
+ relation->rd_att = CreateTemplateTupleDesc(natts);
relation->rd_att->tdrefcount = 1; /* mark as refcounted */
relation->rd_att->tdtypeid = relationReltype;
@@ -2964,7 +2960,6 @@ AtEOXact_cleanup(Relation relation, bool isCommit)
{
list_free(relation->rd_indexlist);
relation->rd_indexlist = NIL;
- relation->rd_oidindex = InvalidOid;
relation->rd_pkindex = InvalidOid;
relation->rd_replidindex = InvalidOid;
relation->rd_indexvalid = 0;
@@ -3077,7 +3072,6 @@ AtEOSubXact_cleanup(Relation relation, bool isCommit,
{
list_free(relation->rd_indexlist);
relation->rd_indexlist = NIL;
- relation->rd_oidindex = InvalidOid;
relation->rd_pkindex = InvalidOid;
relation->rd_replidindex = InvalidOid;
relation->rd_indexvalid = 0;
@@ -3208,7 +3202,6 @@ RelationBuildLocalRelation(const char *relname,
rel->rd_rel->relnamespace = relnamespace;
rel->rd_rel->relkind = relkind;
- rel->rd_rel->relhasoids = rel->rd_att->tdhasoid;
rel->rd_rel->relnatts = natts;
rel->rd_rel->reltype = InvalidOid;
/* needed when bootstrapping: */
@@ -3508,15 +3501,15 @@ RelationCacheInitializePhase2(void)
if (!load_relcache_init_file(true))
{
formrdesc("pg_database", DatabaseRelation_Rowtype_Id, true,
- true, Natts_pg_database, Desc_pg_database);
+ Natts_pg_database, Desc_pg_database);
formrdesc("pg_authid", AuthIdRelation_Rowtype_Id, true,
- true, Natts_pg_authid, Desc_pg_authid);
+ Natts_pg_authid, Desc_pg_authid);
formrdesc("pg_auth_members", AuthMemRelation_Rowtype_Id, true,
- false, Natts_pg_auth_members, Desc_pg_auth_members);
+ Natts_pg_auth_members, Desc_pg_auth_members);
formrdesc("pg_shseclabel", SharedSecLabelRelation_Rowtype_Id, true,
- false, Natts_pg_shseclabel, Desc_pg_shseclabel);
+ Natts_pg_shseclabel, Desc_pg_shseclabel);
formrdesc("pg_subscription", SubscriptionRelation_Rowtype_Id, true,
- true, Natts_pg_subscription, Desc_pg_subscription);
+ Natts_pg_subscription, Desc_pg_subscription);
#define NUM_CRITICAL_SHARED_RELS 5 /* fix if you change list above */
}
@@ -3567,13 +3560,13 @@ RelationCacheInitializePhase3(void)
needNewCacheFile = true;
formrdesc("pg_class", RelationRelation_Rowtype_Id, false,
- true, Natts_pg_class, Desc_pg_class);
+ Natts_pg_class, Desc_pg_class);
formrdesc("pg_attribute", AttributeRelation_Rowtype_Id, false,
- false, Natts_pg_attribute, Desc_pg_attribute);
+ Natts_pg_attribute, Desc_pg_attribute);
formrdesc("pg_proc", ProcedureRelation_Rowtype_Id, false,
- true, Natts_pg_proc, Desc_pg_proc);
+ Natts_pg_proc, Desc_pg_proc);
formrdesc("pg_type", TypeRelation_Rowtype_Id, false,
- true, Natts_pg_type, Desc_pg_type);
+ Natts_pg_type, Desc_pg_type);
#define NUM_CRITICAL_LOCAL_RELS 4 /* fix if you change list above */
}
@@ -3725,7 +3718,6 @@ RelationCacheInitializePhase3(void)
*/
Assert(relation->rd_att->tdtypeid == relp->reltype);
Assert(relation->rd_att->tdtypmod == -1);
- Assert(relation->rd_att->tdhasoid == relp->relhasoids);
ReleaseSysCache(htup);
@@ -3868,8 +3860,7 @@ load_critical_index(Oid indexoid, Oid heapoid)
* extracting fields.
*/
static TupleDesc
-BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs,
- bool hasoids)
+BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs)
{
TupleDesc result;
MemoryContext oldcxt;
@@ -3877,7 +3868,7 @@ BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs,
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
- result = CreateTemplateTupleDesc(natts, hasoids);
+ result = CreateTemplateTupleDesc(natts);
result->tdtypeid = RECORDOID; /* not right, but we don't care */
result->tdtypmod = -1;
@@ -3906,8 +3897,7 @@ GetPgClassDescriptor(void)
/* Already done? */
if (pgclassdesc == NULL)
pgclassdesc = BuildHardcodedDescriptor(Natts_pg_class,
- Desc_pg_class,
- true);
+ Desc_pg_class);
return pgclassdesc;
}
@@ -3920,8 +3910,7 @@ GetPgIndexDescriptor(void)
/* Already done? */
if (pgindexdesc == NULL)
pgindexdesc = BuildHardcodedDescriptor(Natts_pg_index,
- Desc_pg_index,
- false);
+ Desc_pg_index);
return pgindexdesc;
}
@@ -4145,7 +4134,7 @@ RelationGetFKeyList(Relation relation)
continue;
info = makeNode(ForeignKeyCacheInfo);
- info->conoid = HeapTupleGetOid(htup);
+ info->conoid = constraint->oid;
info->conrelid = constraint->conrelid;
info->confrelid = constraint->confrelid;
@@ -4248,11 +4237,6 @@ RelationGetFKeyList(Relation relation)
* since the caller will typically be doing syscache lookups on the relevant
* indexes, and syscache lookup could cause SI messages to be processed!
*
- * We also update rd_oidindex, which this module treats as effectively part
- * of the index list. rd_oidindex is valid when rd_indexvalid isn't zero;
- * it is the pg_class OID of a unique index on OID when the relation has one,
- * and InvalidOid if there is no such index.
- *
* In exactly the same way, we update rd_pkindex, which is the OID of the
* relation's primary key index if any, else InvalidOid; and rd_replidindex,
* which is the pg_class OID of an index to be used as the relation's
@@ -4268,7 +4252,6 @@ RelationGetIndexList(Relation relation)
List *result;
List *oldlist;
char replident = relation->rd_rel->relreplident;
- Oid oidIndex = InvalidOid;
Oid pkeyIndex = InvalidOid;
Oid candidateIndex = InvalidOid;
MemoryContext oldcxt;
@@ -4284,7 +4267,6 @@ RelationGetIndexList(Relation relation)
* if we get some sort of error partway through.
*/
result = NIL;
- oidIndex = InvalidOid;
/* Prepare to scan pg_index for entries having indrelid = this rel. */
ScanKeyInit(&skey,
@@ -4299,9 +4281,6 @@ RelationGetIndexList(Relation relation)
while (HeapTupleIsValid(htup = systable_getnext(indscan)))
{
Form_pg_index index = (Form_pg_index) GETSTRUCT(htup);
- Datum indclassDatum;
- oidvector *indclass;
- bool isnull;
/*
* Ignore any indexes that are currently being dropped. This will
@@ -4316,18 +4295,6 @@ RelationGetIndexList(Relation relation)
result = insert_ordered_oid(result, index->indexrelid);
/*
- * indclass cannot be referenced directly through the C struct,
- * because it comes after the variable-width indkey field. Must
- * extract the datum the hard way...
- */
- indclassDatum = heap_getattr(htup,
- Anum_pg_index_indclass,
- GetPgIndexDescriptor(),
- &isnull);
- Assert(!isnull);
- indclass = (oidvector *) DatumGetPointer(indclassDatum);
-
- /*
* Invalid, non-unique, non-immediate or predicate indexes aren't
* interesting for either oid indexes or replication identity indexes,
* so don't check them.
@@ -4337,12 +4304,6 @@ RelationGetIndexList(Relation relation)
!heap_attisnull(htup, Anum_pg_index_indpred, NULL))
continue;
- /* Check to see if is a usable btree index on OID */
- if (index->indnatts == 1 &&
- index->indkey.values[0] == ObjectIdAttributeNumber &&
- indclass->values[0] == OID_BTREE_OPS_OID)
- oidIndex = index->indexrelid;
-
/* remember primary key index if any */
if (index->indisprimary)
pkeyIndex = index->indexrelid;
@@ -4360,7 +4321,6 @@ RelationGetIndexList(Relation relation)
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
oldlist = relation->rd_indexlist;
relation->rd_indexlist = list_copy(result);
- relation->rd_oidindex = oidIndex;
relation->rd_pkindex = pkeyIndex;
if (replident == REPLICA_IDENTITY_DEFAULT && OidIsValid(pkeyIndex))
relation->rd_replidindex = pkeyIndex;
@@ -4435,7 +4395,11 @@ RelationGetStatExtList(Relation relation)
NULL, 1, &skey);
while (HeapTupleIsValid(htup = systable_getnext(indscan)))
- result = insert_ordered_oid(result, HeapTupleGetOid(htup));
+ {
+ Oid oid = ((Form_pg_statistic_ext) GETSTRUCT(htup))->oid;
+
+ result = insert_ordered_oid(result, oid);
+ }
systable_endscan(indscan);
@@ -4510,7 +4474,7 @@ insert_ordered_oid(List *list, Oid datum)
* touch rd_keyattr, rd_pkattr or rd_idattr.
*/
void
-RelationSetIndexList(Relation relation, List *indexIds, Oid oidIndex)
+RelationSetIndexList(Relation relation, List *indexIds)
{
MemoryContext oldcxt;
@@ -4522,7 +4486,6 @@ RelationSetIndexList(Relation relation, List *indexIds, Oid oidIndex)
/* Okay to replace old list */
list_free(relation->rd_indexlist);
relation->rd_indexlist = indexIds;
- relation->rd_oidindex = oidIndex;
/*
* For the moment, assume the target rel hasn't got a pk or replica index.
@@ -4536,34 +4499,6 @@ RelationSetIndexList(Relation relation, List *indexIds, Oid oidIndex)
}
/*
- * RelationGetOidIndex -- get the pg_class OID of the relation's OID index
- *
- * Returns InvalidOid if there is no such index.
- */
-Oid
-RelationGetOidIndex(Relation relation)
-{
- List *ilist;
-
- /*
- * If relation doesn't have OIDs at all, caller is probably confused. (We
- * could just silently return InvalidOid, but it seems better to throw an
- * assertion.)
- */
- Assert(relation->rd_rel->relhasoids);
-
- if (relation->rd_indexvalid == 0)
- {
- /* RelationGetIndexList does the heavy lifting. */
- ilist = RelationGetIndexList(relation);
- list_free(ilist);
- Assert(relation->rd_indexvalid != 0);
- }
-
- return relation->rd_oidindex;
-}
-
-/*
* RelationGetPrimaryKeyIndex -- get OID of the relation's primary key index
*
* Returns InvalidOid if there is no such index.
@@ -5472,8 +5407,7 @@ load_relcache_init_file(bool shared)
rel->rd_rel = relform;
/* initialize attribute tuple forms */
- rel->rd_att = CreateTemplateTupleDesc(relform->relnatts,
- relform->relhasoids);
+ rel->rd_att = CreateTemplateTupleDesc(relform->relnatts);
rel->rd_att->tdrefcount = 1; /* mark as refcounted */
rel->rd_att->tdtypeid = relform->reltype;
@@ -5677,7 +5611,6 @@ load_relcache_init_file(bool shared)
rel->rd_fkeylist = NIL;
rel->rd_fkeyvalid = false;
rel->rd_indexlist = NIL;
- rel->rd_oidindex = InvalidOid;
rel->rd_pkindex = InvalidOid;
rel->rd_replidindex = InvalidOid;
rel->rd_indexattr = NULL;
diff --git a/src/backend/utils/cache/relfilenodemap.c b/src/backend/utils/cache/relfilenodemap.c
index 34679725b3..74c4636895 100644
--- a/src/backend/utils/cache/relfilenodemap.c
+++ b/src/backend/utils/cache/relfilenodemap.c
@@ -212,29 +212,17 @@ RelidByRelfilenode(Oid reltablespace, Oid relfilenode)
while (HeapTupleIsValid(ntp = systable_getnext(scandesc)))
{
+ Form_pg_class classform = (Form_pg_class) GETSTRUCT(ntp);
+
if (found)
elog(ERROR,
"unexpected duplicate for tablespace %u, relfilenode %u",
reltablespace, relfilenode);
found = true;
-#ifdef USE_ASSERT_CHECKING
- {
- bool isnull;
- Oid check;
-
- check = fastgetattr(ntp, Anum_pg_class_reltablespace,
- RelationGetDescr(relation),
- &isnull);
- Assert(!isnull && check == reltablespace);
-
- check = fastgetattr(ntp, Anum_pg_class_relfilenode,
- RelationGetDescr(relation),
- &isnull);
- Assert(!isnull && check == relfilenode);
- }
-#endif
- relid = HeapTupleGetOid(ntp);
+ Assert(classform->reltablespace == reltablespace);
+ Assert(classform->relfilenode == relfilenode);
+ relid = classform->oid;
}
systable_endscan(scandesc);
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 2b381782a3..c26808a833 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -147,7 +147,7 @@ static const struct cachedesc cacheinfo[] = {
AmOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_am_oid,
0,
0,
0
@@ -246,7 +246,7 @@ static const struct cachedesc cacheinfo[] = {
AuthIdOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_authid_oid,
0,
0,
0
@@ -280,7 +280,7 @@ static const struct cachedesc cacheinfo[] = {
OpclassOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_opclass_oid,
0,
0,
0
@@ -302,7 +302,7 @@ static const struct cachedesc cacheinfo[] = {
CollationOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_collation_oid,
0,
0,
0
@@ -316,7 +316,7 @@ static const struct cachedesc cacheinfo[] = {
Anum_pg_conversion_connamespace,
Anum_pg_conversion_conforencoding,
Anum_pg_conversion_contoencoding,
- ObjectIdAttributeNumber,
+ Anum_pg_conversion_oid
},
8
},
@@ -335,7 +335,7 @@ static const struct cachedesc cacheinfo[] = {
ConstraintOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_constraint_oid,
0,
0,
0
@@ -346,7 +346,7 @@ static const struct cachedesc cacheinfo[] = {
ConversionOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_conversion_oid,
0,
0,
0
@@ -357,7 +357,7 @@ static const struct cachedesc cacheinfo[] = {
DatabaseOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_database_oid,
0,
0,
0
@@ -379,7 +379,7 @@ static const struct cachedesc cacheinfo[] = {
EnumOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_enum_oid,
0,
0,
0
@@ -412,7 +412,7 @@ static const struct cachedesc cacheinfo[] = {
EventTriggerOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_event_trigger_oid,
0,
0,
0
@@ -434,7 +434,7 @@ static const struct cachedesc cacheinfo[] = {
ForeignDataWrapperOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_foreign_data_wrapper_oid,
0,
0,
0
@@ -456,7 +456,7 @@ static const struct cachedesc cacheinfo[] = {
ForeignServerOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_foreign_server_oid,
0,
0,
0
@@ -500,7 +500,7 @@ static const struct cachedesc cacheinfo[] = {
LanguageOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_language_oid,
0,
0,
0
@@ -522,7 +522,7 @@ static const struct cachedesc cacheinfo[] = {
NamespaceOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_namespace_oid,
0,
0,
0
@@ -544,7 +544,7 @@ static const struct cachedesc cacheinfo[] = {
OperatorOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_operator_oid,
0,
0,
0
@@ -566,7 +566,7 @@ static const struct cachedesc cacheinfo[] = {
OpfamilyOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_opfamily_oid,
0,
0,
0
@@ -599,7 +599,7 @@ static const struct cachedesc cacheinfo[] = {
ProcedureOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_proc_oid,
0,
0,
0
@@ -621,7 +621,7 @@ static const struct cachedesc cacheinfo[] = {
PublicationObjectIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_publication_oid,
0,
0,
0
@@ -632,7 +632,7 @@ static const struct cachedesc cacheinfo[] = {
PublicationRelObjectIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_publication_rel_oid,
0,
0,
0
@@ -676,7 +676,7 @@ static const struct cachedesc cacheinfo[] = {
ClassOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_class_oid,
0,
0,
0
@@ -742,7 +742,7 @@ static const struct cachedesc cacheinfo[] = {
StatisticExtOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_statistic_ext_oid,
0,
0,
0
@@ -775,7 +775,7 @@ static const struct cachedesc cacheinfo[] = {
SubscriptionObjectIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_subscription_oid,
0,
0,
0
@@ -797,7 +797,7 @@ static const struct cachedesc cacheinfo[] = {
TablespaceOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_tablespace_oid,
0,
0,
0,
@@ -808,7 +808,7 @@ static const struct cachedesc cacheinfo[] = {
TransformOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_transform_oid,
0,
0,
0,
@@ -852,7 +852,7 @@ static const struct cachedesc cacheinfo[] = {
TSConfigOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_ts_config_oid,
0,
0,
0
@@ -874,7 +874,7 @@ static const struct cachedesc cacheinfo[] = {
TSDictionaryOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_ts_dict_oid,
0,
0,
0
@@ -896,7 +896,7 @@ static const struct cachedesc cacheinfo[] = {
TSParserOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_ts_parser_oid,
0,
0,
0
@@ -918,7 +918,7 @@ static const struct cachedesc cacheinfo[] = {
TSTemplateOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_ts_template_oid,
0,
0,
0
@@ -940,7 +940,7 @@ static const struct cachedesc cacheinfo[] = {
TypeOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_type_oid,
0,
0,
0
@@ -951,7 +951,7 @@ static const struct cachedesc cacheinfo[] = {
UserMappingOidIndexId,
1,
{
- ObjectIdAttributeNumber,
+ Anum_pg_user_mapping_oid,
0,
0,
0
@@ -1213,24 +1213,29 @@ SearchSysCacheExists(int cacheId,
/*
* GetSysCacheOid
*
- * A convenience routine that does SearchSysCache and returns the OID
- * of the found tuple, or InvalidOid if no tuple could be found.
+ * A convenience routine that does SearchSysCache and returns the OID in the
+ * oidcol column of the found tuple, or InvalidOid if no tuple could be found.
* No lock is retained on the syscache entry.
*/
Oid
GetSysCacheOid(int cacheId,
+ AttrNumber oidcol,
Datum key1,
Datum key2,
Datum key3,
Datum key4)
{
HeapTuple tuple;
+ bool isNull;
Oid result;
tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
if (!HeapTupleIsValid(tuple))
return InvalidOid;
- result = HeapTupleGetOid(tuple);
+ result = heap_getattr(tuple, oidcol,
+ SysCache[cacheId]->cc_tupdesc,
+ &isNull);
+ Assert(!isNull); /* columns used as oids should never be NULL */
ReleaseSysCache(tuple);
return result;
}
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index 663d4ed8bb..09f9d5fdcb 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -2351,7 +2351,7 @@ load_enum_cache_data(TypeCacheEntry *tcache)
maxitems *= 2;
items = (EnumItem *) repalloc(items, sizeof(EnumItem) * maxitems);
}
- items[numitems].enum_oid = HeapTupleGetOid(enum_tuple);
+ items[numitems].enum_oid = en->oid;
items[numitems].sort_order = en->enumsortorder;
numitems++;
}
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index 6cbbd5b78b..73ff48c196 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -529,7 +529,7 @@ fetch_finfo_record(void *filehandle, const char *funcname)
static CFuncHashTabEntry *
lookup_C_func(HeapTuple procedureTuple)
{
- Oid fn_oid = HeapTupleGetOid(procedureTuple);
+ Oid fn_oid = ((Form_pg_proc) GETSTRUCT(procedureTuple))->oid;
CFuncHashTabEntry *entry;
if (CFuncHash == NULL)
@@ -554,7 +554,7 @@ static void
record_C_func(HeapTuple procedureTuple,
PGFunction user_fn, const Pg_finfo_record *inforec)
{
- Oid fn_oid = HeapTupleGetOid(procedureTuple);
+ Oid fn_oid = ((Form_pg_proc) GETSTRUCT(procedureTuple))->oid;
CFuncHashTabEntry *entry;
bool found;
diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c
index 30923518f5..c4df255f10 100644
--- a/src/backend/utils/fmgr/funcapi.c
+++ b/src/backend/utils/fmgr/funcapi.c
@@ -1301,7 +1301,7 @@ build_function_result_tupdesc_d(char prokind,
if (numoutargs < 2 && prokind != PROKIND_PROCEDURE)
return NULL;
- desc = CreateTemplateTupleDesc(numoutargs, false);
+ desc = CreateTemplateTupleDesc(numoutargs);
for (i = 0; i < numoutargs; i++)
{
TupleDescInitEntry(desc, i + 1,
@@ -1421,7 +1421,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
/* OK, get the column alias */
attname = strVal(linitial(colaliases));
- tupdesc = CreateTemplateTupleDesc(1, false);
+ tupdesc = CreateTemplateTupleDesc(1);
TupleDescInitEntry(tupdesc,
(AttrNumber) 1,
attname,
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 238fe1deec..3d10aa5707 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -616,7 +616,7 @@ InitializeSessionUserId(const char *rolename, Oid roleid)
}
rform = (Form_pg_authid) GETSTRUCT(roleTup);
- roleid = HeapTupleGetOid(roleTup);
+ roleid = rform->oid;
rname = NameStr(rform->rolname);
AuthenticatedUserId = roleid;
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 4f1d2a0d28..b636b1e262 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -146,7 +146,7 @@ GetDatabaseTupleByOid(Oid dboid)
* form a scan key
*/
ScanKeyInit(&key[0],
- ObjectIdAttributeNumber,
+ Anum_pg_database_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(dboid));
@@ -885,7 +885,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", in_dbname)));
dbform = (Form_pg_database) GETSTRUCT(tuple);
- MyDatabaseId = HeapTupleGetOid(tuple);
+ MyDatabaseId = dbform->oid;
MyDatabaseTableSpace = dbform->dattablespace;
/* take database name from the caller, just for paranoia */
strlcpy(dbname, in_dbname, sizeof(dbname));
@@ -902,7 +902,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database %u does not exist", dboid)));
dbform = (Form_pg_database) GETSTRUCT(tuple);
- MyDatabaseId = HeapTupleGetOid(tuple);
+ MyDatabaseId = dbform->oid;
MyDatabaseTableSpace = dbform->dattablespace;
Assert(MyDatabaseId == dboid);
strlcpy(dbname, NameStr(dbform->datname), sizeof(dbname));
@@ -984,7 +984,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
tuple = GetDatabaseTuple(dbname);
if (!HeapTupleIsValid(tuple) ||
- MyDatabaseId != HeapTupleGetOid(tuple) ||
+ MyDatabaseId != ((Form_pg_database) GETSTRUCT(tuple))->oid ||
MyDatabaseTableSpace != ((Form_pg_database) GETSTRUCT(tuple))->dattablespace)
ereport(FATAL,
(errcode(ERRCODE_UNDEFINED_DATABASE),
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 19c678f596..0ec3ff0fd6 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -464,7 +464,6 @@ char *event_source;
bool row_security;
bool check_function_bodies = true;
-bool default_with_oids = false;
bool session_auth_is_superuser;
int log_min_error_statement = ERROR;
@@ -1513,15 +1512,6 @@ static struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},
{
- {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
- gettext_noop("Create new tables with OIDs by default."),
- NULL
- },
- &default_with_oids,
- false,
- NULL, NULL, NULL
- },
- {
{"logging_collector", PGC_POSTMASTER, LOGGING_WHERE,
gettext_noop("Start a subprocess to capture stderr output and/or csvlogs into log files."),
NULL
@@ -8260,7 +8250,7 @@ GetPGVariableResultDesc(const char *name)
if (guc_name_compare(name, "all") == 0)
{
/* need a tuple descriptor representing three TEXT columns */
- tupdesc = CreateTemplateTupleDesc(3, false);
+ tupdesc = CreateTemplateTupleDesc(3);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting",
@@ -8276,7 +8266,7 @@ GetPGVariableResultDesc(const char *name)
(void) GetConfigOptionByName(name, &varname, false);
/* need a tuple descriptor representing a single TEXT column */
- tupdesc = CreateTemplateTupleDesc(1, false);
+ tupdesc = CreateTemplateTupleDesc(1);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, varname,
TEXTOID, -1, 0);
}
@@ -8299,7 +8289,7 @@ ShowGUCConfigOption(const char *name, DestReceiver *dest)
value = GetConfigOptionByName(name, &varname, false);
/* need a tuple descriptor representing a single TEXT column */
- tupdesc = CreateTemplateTupleDesc(1, false);
+ tupdesc = CreateTemplateTupleDesc(1);
TupleDescInitBuiltinEntry(tupdesc, (AttrNumber) 1, varname,
TEXTOID, -1, 0);
@@ -8325,7 +8315,7 @@ ShowAllGUCConfig(DestReceiver *dest)
bool isnull[3] = {false, false, false};
/* need a tuple descriptor representing three TEXT columns */
- tupdesc = CreateTemplateTupleDesc(3, false);
+ tupdesc = CreateTemplateTupleDesc(3);
TupleDescInitBuiltinEntry(tupdesc, (AttrNumber) 1, "name",
TEXTOID, -1, 0);
TupleDescInitBuiltinEntry(tupdesc, (AttrNumber) 2, "setting",
@@ -8767,7 +8757,7 @@ show_all_settings(PG_FUNCTION_ARGS)
* need a tuple descriptor representing NUM_PG_SETTINGS_ATTS columns
* of the appropriate types
*/
- tupdesc = CreateTemplateTupleDesc(NUM_PG_SETTINGS_ATTS, false);
+ tupdesc = CreateTemplateTupleDesc(NUM_PG_SETTINGS_ATTS);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting",
@@ -8907,7 +8897,7 @@ show_all_file_settings(PG_FUNCTION_ARGS)
oldcontext = MemoryContextSwitchTo(per_query_ctx);
/* Build a tuple descriptor for our result type */
- tupdesc = CreateTemplateTupleDesc(NUM_PG_FILE_SETTINGS_ATTS, false);
+ tupdesc = CreateTemplateTupleDesc(NUM_PG_FILE_SETTINGS_ATTS);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "sourcefile",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "sourceline",
diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c
index 3fc8b6a8a8..a376875269 100644
--- a/src/backend/utils/misc/pg_controldata.c
+++ b/src/backend/utils/misc/pg_controldata.c
@@ -41,7 +41,7 @@ pg_control_system(PG_FUNCTION_ARGS)
* Construct a tuple descriptor for the result row. This must match this
* function's pg_proc entry!
*/
- tupdesc = CreateTemplateTupleDesc(4, false);
+ tupdesc = CreateTemplateTupleDesc(4);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pg_control_version",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "catalog_version_no",
@@ -91,7 +91,7 @@ pg_control_checkpoint(PG_FUNCTION_ARGS)
* Construct a tuple descriptor for the result row. This must match this
* function's pg_proc entry!
*/
- tupdesc = CreateTemplateTupleDesc(18, false);
+ tupdesc = CreateTemplateTupleDesc(18);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "checkpoint_lsn",
LSNOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "redo_lsn",
@@ -221,7 +221,7 @@ pg_control_recovery(PG_FUNCTION_ARGS)
* Construct a tuple descriptor for the result row. This must match this
* function's pg_proc entry!
*/
- tupdesc = CreateTemplateTupleDesc(5, false);
+ tupdesc = CreateTemplateTupleDesc(5);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "min_recovery_end_lsn",
LSNOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "min_recovery_end_timeline",
@@ -274,7 +274,7 @@ pg_control_init(PG_FUNCTION_ARGS)
* Construct a tuple descriptor for the result row. This must match this
* function's pg_proc entry!
*/
- tupdesc = CreateTemplateTupleDesc(12, false);
+ tupdesc = CreateTemplateTupleDesc(12);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "max_data_alignment",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "database_block_size",
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 26d5c4c967..3038fe627b 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -649,7 +649,6 @@
#array_nulls = on
#backslash_quote = safe_encoding # on, off, or safe_encoding
-#default_with_oids = off
#escape_string_warning = on
#lo_compat_privileges = off
#operator_precedence_warning = off
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index d34cab0eb8..2b014c86bd 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -1146,7 +1146,7 @@ pg_cursor(PG_FUNCTION_ARGS)
* build tupdesc for result tuples. This must match the definition of the
* pg_cursors view in system_views.sql
*/
- tupdesc = CreateTemplateTupleDesc(6, false);
+ tupdesc = CreateTemplateTupleDesc(6);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "statement",