diff options
author | Andres Freund <andres@anarazel.de> | 2018-11-20 15:36:57 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2018-11-20 16:00:17 -0800 |
commit | 578b229718e8f15fa779e20f086c4b6bb3776106 (patch) | |
tree | 701869752158d27daa080d292befeb2e52f19037 /src/backend/access | |
parent | 0999ac479292c12a7c373e612b15e1ff47077990 (diff) | |
download | postgresql-578b229718e8f15fa779e20f086c4b6bb3776106.tar.gz postgresql-578b229718e8f15fa779e20f086c4b6bb3776106.zip |
Remove WITH OIDS support, change oid catalog column visibility.
Previously tables declared WITH OIDS, including a significant fraction
of the catalog tables, stored the oid column not as a normal column,
but as part of the tuple header.
This special column was not shown by default, which was somewhat odd,
as it's often (consider e.g. pg_class.oid) one of the more important
parts of a row. Neither pg_dump nor COPY included the contents of the
oid column by default.
The fact that the oid column was not an ordinary column necessitated a
significant amount of special case code to support oid columns. That
already was painful for the existing, but upcoming work aiming to make
table storage pluggable, would have required expanding and duplicating
that "specialness" significantly.
WITH OIDS has been deprecated since 2005 (commit ff02d0a05280e0).
Remove it.
Removing includes:
- CREATE TABLE and ALTER TABLE syntax for declaring the table to be
WITH OIDS has been removed (WITH (oids[ = true]) will error out)
- pg_dump does not support dumping tables declared WITH OIDS and will
issue a warning when dumping one (and ignore the oid column).
- restoring an pg_dump archive with pg_restore will warn when
restoring a table with oid contents (and ignore the oid column)
- COPY will refuse to load binary dump that includes oids.
- pg_upgrade will error out when encountering tables declared WITH
OIDS, they have to be altered to remove the oid column first.
- Functionality to access the oid of the last inserted row (like
plpgsql's RESULT_OID, spi's SPI_lastoid, ...) has been removed.
The syntax for declaring a table WITHOUT OIDS (or WITH (oids = false)
for CREATE TABLE) is still supported. While that requires a bit of
support code, it seems unnecessary to break applications / dumps that
do not use oids, and are explicit about not using them.
The biggest user of WITH OID columns was postgres' catalog. This
commit changes all 'magic' oid columns to be columns that are normally
declared and stored. To reduce unnecessary query breakage all the
newly added columns are still named 'oid', even if a table's column
naming scheme would indicate 'reloid' or such. This obviously
requires adapting a lot code, mostly replacing oid access via
HeapTupleGetOid() with access to the underlying Form_pg_*->oid column.
The bootstrap process now assigns oids for all oid columns in
genbki.pl that do not have an explicit value (starting at the largest
oid previously used), only oids assigned later by oids will be above
FirstBootstrapObjectId. As the oid column now is a normal column the
special bootstrap syntax for oids has been removed.
Oids are not automatically assigned during insertion anymore, all
backend code explicitly assigns oids with GetNewOidWithIndex(). For
the rare case that insertions into the catalog via SQL are called for
the new pg_nextoid() function can be used (which only works on catalog
tables).
The fact that oid columns on system tables are now normal columns
means that they will be included in the set of columns expanded
by * (i.e. SELECT * FROM pg_class will now include the table's oid,
previously it did not). It'd not technically be hard to hide oid
column by default, but that'd mean confusing behavior would either
have to be carried forward forever, or it'd cause breakage down the
line.
While it's not unlikely that further adjustments are needed, the
scope/invasiveness of the patch makes it worthwhile to get merge this
now. It's painful to maintain externally, too complicated to commit
after the code code freeze, and a dependency of a number of other
patches.
Catversion bump, for obvious reasons.
Author: Andres Freund, with contributions by John Naylor
Discussion: https://postgr.es/m/20180930034810.ywp2c7awz7opzcfr@alap3.anarazel.de
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/brin/brin_tuple.c | 2 | ||||
-rw-r--r-- | src/backend/access/common/heaptuple.c | 29 | ||||
-rw-r--r-- | src/backend/access/common/reloptions.c | 27 | ||||
-rw-r--r-- | src/backend/access/common/tupconvert.c | 16 | ||||
-rw-r--r-- | src/backend/access/common/tupdesc.c | 18 | ||||
-rw-r--r-- | src/backend/access/gin/ginutil.c | 2 | ||||
-rw-r--r-- | src/backend/access/gist/gistscan.c | 2 | ||||
-rw-r--r-- | src/backend/access/heap/heapam.c | 71 | ||||
-rw-r--r-- | src/backend/access/heap/tuptoaster.c | 21 | ||||
-rw-r--r-- | src/backend/access/transam/commit_ts.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/multixact.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/twophase.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/varsup.c | 4 | ||||
-rw-r--r-- | src/backend/access/transam/xlogfuncs.c | 2 |
14 files changed, 53 insertions, 147 deletions
diff --git a/src/backend/access/brin/brin_tuple.c b/src/backend/access/brin/brin_tuple.c index 00316b899c8..c82bbbaa7f8 100644 --- a/src/backend/access/brin/brin_tuple.c +++ b/src/backend/access/brin/brin_tuple.c @@ -62,7 +62,7 @@ brtuple_disk_tupdesc(BrinDesc *brdesc) /* make sure it's in the bdesc's context */ oldcxt = MemoryContextSwitchTo(brdesc->bd_context); - tupdesc = CreateTemplateTupleDesc(brdesc->bd_totalstored, false); + tupdesc = CreateTemplateTupleDesc(brdesc->bd_totalstored); for (i = 0; i < brdesc->bd_tupdesc->natts; i++) { diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index ccb69bdd616..06dd628a5bc 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -384,7 +384,6 @@ heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc) { case TableOidAttributeNumber: case SelfItemPointerAttributeNumber: - case ObjectIdAttributeNumber: case MinTransactionIdAttributeNumber: case MinCommandIdAttributeNumber: case MaxTransactionIdAttributeNumber: @@ -642,9 +641,6 @@ heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) /* pass-by-reference datatype */ result = PointerGetDatum(&(tup->t_self)); break; - case ObjectIdAttributeNumber: - result = ObjectIdGetDatum(HeapTupleGetOid(tup)); - break; case MinTransactionIdAttributeNumber: result = TransactionIdGetDatum(HeapTupleHeaderGetRawXmin(tup->t_data)); break; @@ -839,9 +835,6 @@ expand_tuple(HeapTuple *targetHeapTuple, else targetNullLen = 0; - if (tupleDesc->tdhasoid) - len += sizeof(Oid); - /* * Allocate and zero the space needed. Note that the tuple body and * HeapTupleData management structure are allocated in one chunk. @@ -1065,9 +1058,6 @@ heap_form_tuple(TupleDesc tupleDescriptor, if (hasnull) len += BITMAPLEN(numberOfAttributes); - if (tupleDescriptor->tdhasoid) - len += sizeof(Oid); - hoff = len = MAXALIGN(len); /* align user data safely */ data_len = heap_compute_data_size(tupleDescriptor, values, isnull); @@ -1099,9 +1089,6 @@ heap_form_tuple(TupleDesc tupleDescriptor, HeapTupleHeaderSetNatts(td, numberOfAttributes); td->t_hoff = hoff; - if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */ - td->t_infomask = HEAP_HASOID; - heap_fill_tuple(tupleDescriptor, values, isnull, @@ -1171,14 +1158,11 @@ heap_modify_tuple(HeapTuple tuple, pfree(isnull); /* - * copy the identification info of the old tuple: t_ctid, t_self, and OID - * (if any) + * copy the identification info of the old tuple: t_ctid, t_self */ newTuple->t_data->t_ctid = tuple->t_data->t_ctid; newTuple->t_self = tuple->t_self; newTuple->t_tableOid = tuple->t_tableOid; - if (tupleDesc->tdhasoid) - HeapTupleSetOid(newTuple, HeapTupleGetOid(tuple)); return newTuple; } @@ -1237,14 +1221,11 @@ heap_modify_tuple_by_cols(HeapTuple tuple, pfree(isnull); /* - * copy the identification info of the old tuple: t_ctid, t_self, and OID - * (if any) + * copy the identification info of the old tuple: t_ctid, t_self */ newTuple->t_data->t_ctid = tuple->t_data->t_ctid; newTuple->t_self = tuple->t_self; newTuple->t_tableOid = tuple->t_tableOid; - if (tupleDesc->tdhasoid) - HeapTupleSetOid(newTuple, HeapTupleGetOid(tuple)); return newTuple; } @@ -1412,9 +1393,6 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor, if (hasnull) len += BITMAPLEN(numberOfAttributes); - if (tupleDescriptor->tdhasoid) - len += sizeof(Oid); - hoff = len = MAXALIGN(len); /* align user data safely */ data_len = heap_compute_data_size(tupleDescriptor, values, isnull); @@ -1433,9 +1411,6 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor, HeapTupleHeaderSetNatts(tuple, numberOfAttributes); tuple->t_hoff = hoff + MINIMAL_TUPLE_OFFSET; - if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */ - tuple->t_infomask = HEAP_HASOID; - heap_fill_tuple(tupleDescriptor, values, isnull, diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index db84da06789..eece89aa21f 100644 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@ -757,8 +757,8 @@ add_string_reloption(bits32 kinds, const char *name, const char *desc, const cha * reloptions value (possibly NULL), and we replace or remove entries * as needed. * - * If ignoreOids is true, then we should ignore any occurrence of "oids" - * in the list (it will be or has been handled by interpretOidsOption()). + * If acceptOidsOff is true, then we allow oids = false, but throw error when + * on. This is solely needed for backwards compatibility. * * Note that this is not responsible for determining whether the options * are valid, but it does check that namespaces for all the options given are @@ -771,7 +771,7 @@ add_string_reloption(bits32 kinds, const char *name, const char *desc, const cha */ Datum transformRelOptions(Datum oldOptions, List *defList, const char *namspace, - char *validnsps[], bool ignoreOids, bool isReset) + char *validnsps[], bool acceptOidsOff, bool isReset) { Datum result; ArrayBuildState *astate; @@ -882,9 +882,6 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace, def->defnamespace))); } - if (ignoreOids && strcmp(def->defname, "oids") == 0) - continue; - /* ignore if not in the same namespace */ if (namspace == NULL) { @@ -905,6 +902,24 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace, value = defGetString(def); else value = "true"; + + /* + * This is not a great place for this test, but there's no other + * convenient place to filter the option out. As WITH (oids = + * false) will be removed someday, this seems like an acceptable + * amount of ugly. + */ + if (acceptOidsOff && def->defnamespace == NULL && + strcmp(def->defname, "oids") == 0) + { + if (defGetBoolean(def)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("tables declared WITH OIDS are not supported"))); + /* skip over option, reloptions machinery doesn't know it */ + continue; + } + len = VARHDRSZ + strlen(def->defname) + 1 + strlen(value); /* +1 leaves room for sprintf's trailing null */ t = (text *) palloc(len + 1); diff --git a/src/backend/access/common/tupconvert.c b/src/backend/access/common/tupconvert.c index 21fe8ae4909..fc88aa376ac 100644 --- a/src/backend/access/common/tupconvert.c +++ b/src/backend/access/common/tupconvert.c @@ -138,13 +138,9 @@ convert_tuples_by_position(TupleDesc indesc, /* * Check to see if the map is one-to-one, in which case we need not do a - * tuple conversion. We must also insist that both tupdescs either - * specify or don't specify an OID column, else we need a conversion to - * add/remove space for that. (For some callers, presence or absence of - * an OID column perhaps would not really matter, but let's be safe.) + * tuple conversion. */ - if (indesc->natts == outdesc->natts && - indesc->tdhasoid == outdesc->tdhasoid) + if (indesc->natts == outdesc->natts) { for (i = 0; i < n; i++) { @@ -344,13 +340,9 @@ convert_tuples_by_name_map_if_req(TupleDesc indesc, /* * Check to see if the map is one-to-one, in which case we need not do a - * tuple conversion. We must also insist that both tupdescs either - * specify or don't specify an OID column, else we need a conversion to - * add/remove space for that. (For some callers, presence or absence of - * an OID column perhaps would not really matter, but let's be safe.) + * tuple conversion. */ - if (indesc->natts == outdesc->natts && - indesc->tdhasoid == outdesc->tdhasoid) + if (indesc->natts == outdesc->natts) { same = true; for (i = 0; i < n; i++) diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index b0434b46720..5354a04639b 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -42,7 +42,7 @@ * caller can overwrite this if needed. */ TupleDesc -CreateTemplateTupleDesc(int natts, bool hasoid) +CreateTemplateTupleDesc(int natts) { TupleDesc desc; @@ -73,7 +73,6 @@ CreateTemplateTupleDesc(int natts, bool hasoid) desc->constr = NULL; desc->tdtypeid = RECORDOID; desc->tdtypmod = -1; - desc->tdhasoid = hasoid; desc->tdrefcount = -1; /* assume not reference-counted */ return desc; @@ -88,12 +87,12 @@ CreateTemplateTupleDesc(int natts, bool hasoid) * caller can overwrite this if needed. */ TupleDesc -CreateTupleDesc(int natts, bool hasoid, Form_pg_attribute *attrs) +CreateTupleDesc(int natts, Form_pg_attribute *attrs) { TupleDesc desc; int i; - desc = CreateTemplateTupleDesc(natts, hasoid); + desc = CreateTemplateTupleDesc(natts); for (i = 0; i < natts; ++i) memcpy(TupleDescAttr(desc, i), attrs[i], ATTRIBUTE_FIXED_PART_SIZE); @@ -114,7 +113,7 @@ CreateTupleDescCopy(TupleDesc tupdesc) TupleDesc desc; int i; - desc = CreateTemplateTupleDesc(tupdesc->natts, tupdesc->tdhasoid); + desc = CreateTemplateTupleDesc(tupdesc->natts); /* Flat-copy the attribute array */ memcpy(TupleDescAttr(desc, 0), @@ -154,7 +153,7 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc) TupleConstr *constr = tupdesc->constr; int i; - desc = CreateTemplateTupleDesc(tupdesc->natts, tupdesc->tdhasoid); + desc = CreateTemplateTupleDesc(tupdesc->natts); /* Flat-copy the attribute array */ memcpy(TupleDescAttr(desc, 0), @@ -416,8 +415,6 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) return false; if (tupdesc1->tdtypeid != tupdesc2->tdtypeid) return false; - if (tupdesc1->tdhasoid != tupdesc2->tdhasoid) - return false; for (i = 0; i < tupdesc1->natts; i++) { @@ -574,7 +571,6 @@ hashTupleDesc(TupleDesc desc) s = hash_combine(0, hash_uint32(desc->natts)); s = hash_combine(s, hash_uint32(desc->tdtypeid)); - s = hash_combine(s, hash_uint32(desc->tdhasoid)); for (i = 0; i < desc->natts; ++i) s = hash_combine(s, hash_uint32(TupleDescAttr(desc, i)->atttypid)); @@ -800,7 +796,7 @@ BuildDescForRelation(List *schema) * allocate a new tuple descriptor */ natts = list_length(schema); - desc = CreateTemplateTupleDesc(natts, false); + desc = CreateTemplateTupleDesc(natts); has_not_null = false; attnum = 0; @@ -900,7 +896,7 @@ BuildDescFromLists(List *names, List *types, List *typmods, List *collations) /* * allocate a new tuple descriptor */ - desc = CreateTemplateTupleDesc(natts, false); + desc = CreateTemplateTupleDesc(natts); attnum = 0; diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c index 0a32182dd7f..d7696a1ad03 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -104,7 +104,7 @@ initGinState(GinState *state, Relation index) state->tupdesc[i] = state->origTupdesc; else { - state->tupdesc[i] = CreateTemplateTupleDesc(2, false); + state->tupdesc[i] = CreateTemplateTupleDesc(2); TupleDescInitEntry(state->tupdesc[i], (AttrNumber) 1, NULL, INT2OID, -1, 0); diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index 4d97ff1d5d2..6b18bd3afb8 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -167,7 +167,7 @@ gistrescan(IndexScanDesc scan, ScanKey key, int nkeys, * types. */ natts = RelationGetNumberOfAttributes(scan->indexRelation); - so->giststate->fetchTupdesc = CreateTemplateTupleDesc(natts, false); + so->giststate->fetchTupdesc = CreateTemplateTupleDesc(natts); for (attno = 1; attno <= natts; attno++) { TupleDescInitEntry(so->giststate->fetchTupdesc, attno, NULL, diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index da2a8f34c20..96501456422 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -2454,7 +2454,7 @@ ReleaseBulkInsertStatePin(BulkInsertState bistate) * TID where the tuple was stored. But note that any toasting of fields * within the tuple data is NOT reflected into *tup. */ -Oid +void heap_insert(Relation relation, HeapTuple tup, CommandId cid, int options, BulkInsertState bistate) { @@ -2628,8 +2628,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid, tup->t_self = heaptup->t_self; heap_freetuple(heaptup); } - - return HeapTupleGetOid(tup); } /* @@ -2656,30 +2654,6 @@ heap_prepare_insert(Relation relation, HeapTuple tup, TransactionId xid, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), errmsg("cannot insert tuples in a parallel worker"))); - if (relation->rd_rel->relhasoids) - { -#ifdef NOT_USED - /* this is redundant with an Assert in HeapTupleSetOid */ - Assert(tup->t_data->t_infomask & HEAP_HASOID); -#endif - - /* - * If the object id of this tuple has already been assigned, trust the - * caller. There are a couple of ways this can happen. At initial db - * creation, the backend program sets oids for tuples. When we define - * an index, we set the oid. Finally, in the future, we may allow - * users to set their own object ids in order to support a persistent - * object store (objects need to contain pointers to one another). - */ - if (!OidIsValid(HeapTupleGetOid(tup))) - HeapTupleSetOid(tup, GetNewOid(relation)); - } - else - { - /* check there is not space for an OID */ - Assert(!(tup->t_data->t_infomask & HEAP_HASOID)); - } - tup->t_data->t_infomask &= ~(HEAP_XACT_MASK); tup->t_data->t_infomask2 &= ~(HEAP2_XACT_MASK); tup->t_data->t_infomask |= HEAP_XMAX_INVALID; @@ -2995,10 +2969,10 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples, * This should be used rather than using heap_insert directly in most places * where we are modifying system catalogs. */ -Oid +void simple_heap_insert(Relation relation, HeapTuple tup) { - return heap_insert(relation, tup, GetCurrentCommandId(true), 0, NULL); + heap_insert(relation, tup, GetCurrentCommandId(true), 0, NULL); } /* @@ -3656,21 +3630,6 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, /* the new tuple is ready, except for this: */ newtup->t_tableOid = RelationGetRelid(relation); - /* Fill in OID for newtup */ - if (relation->rd_rel->relhasoids) - { -#ifdef NOT_USED - /* this is redundant with an Assert in HeapTupleSetOid */ - Assert(newtup->t_data->t_infomask & HEAP_HASOID); -#endif - HeapTupleSetOid(newtup, HeapTupleGetOid(&oldtup)); - } - else - { - /* check there is not space for an OID */ - Assert(!(newtup->t_data->t_infomask & HEAP_HASOID)); - } - /* Determine columns modified by the update. */ modified_attrs = HeapDetermineModifiedColumns(relation, interesting_attrs, &oldtup, newtup); @@ -4437,13 +4396,12 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum, /* * Likewise, automatically say "not equal" for any system attribute other - * than OID and tableOID; we cannot expect these to be consistent in a HOT - * chain, or even to be set correctly yet in the new tuple. + * than tableOID; we cannot expect these to be consistent in a HOT chain, + * or even to be set correctly yet in the new tuple. */ if (attrnum < 0) { - if (attrnum != ObjectIdAttributeNumber && - attrnum != TableOidAttributeNumber) + if (attrnum != TableOidAttributeNumber) return false; } @@ -8123,16 +8081,7 @@ ExtractReplicaIdentity(Relation relation, HeapTuple tp, bool key_changed, bool * int attno = idx_rel->rd_index->indkey.values[natt]; if (attno < 0) - { - /* - * The OID column can appear in an index definition, but that's - * OK, because we always copy the OID if present (see below). - * Other system columns may not. - */ - if (attno == ObjectIdAttributeNumber) - continue; elog(ERROR, "system column in index"); - } nulls[attno - 1] = false; } @@ -8141,14 +8090,6 @@ ExtractReplicaIdentity(Relation relation, HeapTuple tp, bool key_changed, bool * RelationClose(idx_rel); /* - * Always copy oids if the table has them, even if not included in the - * index. The space in the logged tuple is used anyway, so there's little - * point in not including the information. - */ - if (relation->rd_rel->relhasoids) - HeapTupleSetOid(key_tuple, HeapTupleGetOid(tp)); - - /* * If the tuple, which by here only contains indexed columns, still has * toasted columns, force them to be inlined. This is somewhat unlikely * since there's limits on the size of indexed columns, so we don't diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c index cd42c50b09c..fdbaf38126d 100644 --- a/src/backend/access/heap/tuptoaster.c +++ b/src/backend/access/heap/tuptoaster.c @@ -723,8 +723,6 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup, hoff = SizeofHeapTupleHeader; if (has_nulls) hoff += BITMAPLEN(numAttrs); - if (newtup->t_data->t_infomask & HEAP_HASOID) - hoff += sizeof(Oid); hoff = MAXALIGN(hoff); /* now convert to a limit on the tuple data size */ maxDataLen = RelationGetToastTupleTarget(rel, TOAST_TUPLE_TARGET) - hoff; @@ -1013,8 +1011,6 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup, new_header_len = SizeofHeapTupleHeader; if (has_nulls) new_header_len += BITMAPLEN(numAttrs); - if (olddata->t_infomask & HEAP_HASOID) - new_header_len += sizeof(Oid); new_header_len = MAXALIGN(new_header_len); new_data_len = heap_compute_data_size(tupleDesc, toast_values, toast_isnull); @@ -1036,8 +1032,6 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup, memcpy(new_data, olddata, SizeofHeapTupleHeader); HeapTupleHeaderSetNatts(new_data, numAttrs); new_data->t_hoff = new_header_len; - if (olddata->t_infomask & HEAP_HASOID) - HeapTupleHeaderSetOid(new_data, HeapTupleHeaderGetOid(olddata)); /* Copy over the data, and fill the null bitmap if needed */ heap_fill_tuple(tupleDesc, @@ -1124,13 +1118,10 @@ toast_flatten_tuple(HeapTuple tup, TupleDesc tupleDesc) new_tuple = heap_form_tuple(tupleDesc, toast_values, toast_isnull); /* - * Be sure to copy the tuple's OID and identity fields. We also make a - * point of copying visibility info, just in case anybody looks at those - * fields in a syscache entry. + * Be sure to copy the tuple's identity fields. We also make a point of + * copying visibility info, just in case anybody looks at those fields in + * a syscache entry. */ - if (tupleDesc->tdhasoid) - HeapTupleSetOid(new_tuple, HeapTupleGetOid(tup)); - new_tuple->t_self = tup->t_self; new_tuple->t_tableOid = tup->t_tableOid; @@ -1244,8 +1235,6 @@ toast_flatten_tuple_to_datum(HeapTupleHeader tup, new_header_len = SizeofHeapTupleHeader; if (has_nulls) new_header_len += BITMAPLEN(numAttrs); - if (tup->t_infomask & HEAP_HASOID) - new_header_len += sizeof(Oid); new_header_len = MAXALIGN(new_header_len); new_data_len = heap_compute_data_size(tupleDesc, toast_values, toast_isnull); @@ -1259,8 +1248,6 @@ toast_flatten_tuple_to_datum(HeapTupleHeader tup, memcpy(new_data, tup, SizeofHeapTupleHeader); HeapTupleHeaderSetNatts(new_data, numAttrs); new_data->t_hoff = new_header_len; - if (tup->t_infomask & HEAP_HASOID) - HeapTupleHeaderSetOid(new_data, HeapTupleHeaderGetOid(tup)); /* Set the composite-Datum header fields correctly */ HeapTupleHeaderSetDatumLength(new_data, new_tuple_len); @@ -1796,7 +1783,7 @@ toast_delete_datum(Relation rel, Datum value, bool is_speculative) * * Test whether a toast value with the given ID exists in the toast relation. * For safety, we consider a value to exist if there are either live or dead - * toast rows with that ID; see notes for GetNewOid(). + * toast rows with that ID; see notes for GetNewOidWithIndex(). * ---------- */ static bool diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c index 599203c96ce..66b940c66cc 100644 --- a/src/backend/access/transam/commit_ts.c +++ b/src/backend/access/transam/commit_ts.c @@ -434,7 +434,7 @@ pg_last_committed_xact(PG_FUNCTION_ARGS) * Construct a tuple descriptor for the result row. This must match this * function's pg_proc entry! */ - tupdesc = CreateTemplateTupleDesc(2, false); + tupdesc = CreateTemplateTupleDesc(2); TupleDescInitEntry(tupdesc, (AttrNumber) 1, "xid", XIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "timestamp", diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 365daf153ab..82346f1000d 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -3368,7 +3368,7 @@ pg_get_multixact_members(PG_FUNCTION_ARGS) false); multi->iter = 0; - tupdesc = CreateTemplateTupleDesc(2, false); + tupdesc = CreateTemplateTupleDesc(2); TupleDescInitEntry(tupdesc, (AttrNumber) 1, "xid", XIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "mode", diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 3942734e5ae..e65dccc6a2c 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -734,7 +734,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS) /* build tupdesc for result tuples */ /* this had better match pg_prepared_xacts view in system_views.sql */ - tupdesc = CreateTemplateTupleDesc(5, false); + tupdesc = CreateTemplateTupleDesc(5); TupleDescInitEntry(tupdesc, (AttrNumber) 1, "transaction", XIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "gid", diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 664735b3814..a5eb29e01ac 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -451,8 +451,8 @@ ForceTransactionIdLimitUpdate(void) * OIDs are generated by a cluster-wide counter. Since they are only 32 bits * wide, counter wraparound will occur eventually, and therefore it is unwise * to assume they are unique unless precautions are taken to make them so. - * Hence, this routine should generally not be used directly. The only - * direct callers should be GetNewOid() and GetNewRelFileNode() in + * Hence, this routine should generally not be used directly. The only direct + * callers should be GetNewOidWithIndex() and GetNewRelFileNode() in * catalog/catalog.c. */ Oid diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index a31adcca5eb..bd18f496af1 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -471,7 +471,7 @@ pg_walfile_name_offset(PG_FUNCTION_ARGS) * Construct a tuple descriptor for the result row. This must match this * function's pg_proc entry! */ - resultTupleDesc = CreateTemplateTupleDesc(2, false); + resultTupleDesc = CreateTemplateTupleDesc(2); TupleDescInitEntry(resultTupleDesc, (AttrNumber) 1, "file_name", TEXTOID, -1, 0); TupleDescInitEntry(resultTupleDesc, (AttrNumber) 2, "file_offset", |