Oid
make_new_heap(Oid OIDOldHeap, Oid NewTableSpace)
{
- TupleDesc OldHeapDesc,
- tupdesc;
+ TupleDesc OldHeapDesc;
char NewHeapName[NAMEDATALEN];
Oid OIDNewHeap;
Oid toastid;
OldHeapDesc = RelationGetDescr(OldHeap);
/*
- * Need to make a copy of the tuple descriptor, since
- * heap_create_with_catalog modifies it. Note that the NewHeap will not
+ * Note that the NewHeap will not
* receive any of the defaults or constraints associated with the OldHeap;
* we don't need 'em, and there's no reason to spend cycles inserting them
* into the catalogs only to delete them.
*/
- tupdesc = CreateTupleDescCopy(OldHeapDesc);
/*
* But we do want to use reloptions of the old heap for new heap.
InvalidOid,
InvalidOid,
OldHeap->rd_rel->relowner,
- tupdesc,
+ OldHeapDesc,
NIL,
OldHeap->rd_rel->relkind,
OldHeap->rd_rel->relpersistence,
Oid tablespaceId;
Datum reloptions;
Oid intoRelationId;
- TupleDesc tupdesc;
DR_intorel *myState;
static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
false);
(void) heap_reloptions(RELKIND_RELATION, reloptions, true);
- /* Copy the tupdesc because heap_create_with_catalog modifies it */
- tupdesc = CreateTupleDescCopy(queryDesc->tupDesc);
-
/* Now we can actually create the new relation */
intoRelationId = heap_create_with_catalog(intoName,
namespaceId,
InvalidOid,
InvalidOid,
GetUserId(),
- tupdesc,
+ queryDesc->tupDesc,
NIL,
RELKIND_RELATION,
into->rel->relpersistence,
allowSystemTableMods);
Assert(intoRelationId != InvalidOid);
- FreeTupleDesc(tupdesc);
-
/*
* Advance command counter so that the newly-created relation's catalog
* tuples will be visible to heap_open.