diff options
Diffstat (limited to 'src/backend/access/common')
-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 |
4 files changed, 34 insertions, 56 deletions
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; |