Revert "Copy data from heap tuples instead of using references"

This reverts commit 50e8638ede.
release-11.0-gledis
gledis69 2022-06-01 13:06:38 +03:00
parent 50e8638ede
commit a64e135a36
7 changed files with 6 additions and 14 deletions

View File

@ -3000,7 +3000,7 @@ InstalledExtensionVersionColumnar(void)
}
installedExtensionVersion = text_to_cstring(DatumGetTextPCopy(installedVersion));
installedExtensionVersion = text_to_cstring(DatumGetTextPP(installedVersion));
}
else
{

View File

@ -175,7 +175,7 @@ RecreateDomainStmt(Oid domainOid)
*
* There is no supported way to go from a cooked expression to a raw expression.
*/
constraint->cooked_expr = text_to_cstring(DatumGetTextPCopy(conbin));
constraint->cooked_expr = TextDatumGetCString(conbin);
stmt->constraints = lappend(stmt->constraints, constraint);
}

View File

@ -337,7 +337,6 @@ ExtractEncryptedPassword(Oid roleOid)
Datum passwordDatum = heap_getattr(tuple, Anum_pg_authid_rolpassword,
pgAuthIdDescription, &isNull);
char *passwordCstring = text_to_cstring(DatumGetTextPCopy(passwordDatum));
table_close(pgAuthId, AccessShareLock);
ReleaseSysCache(tuple);
@ -347,7 +346,7 @@ ExtractEncryptedPassword(Oid roleOid)
return NULL;
}
return pstrdup(passwordCstring);
return pstrdup(TextDatumGetCString(passwordDatum));
}
@ -399,7 +398,7 @@ GenerateAlterRoleSetIfExistsCommandList(HeapTuple tuple,
*/
for (i = 0; i < nconfigs; i++)
{
char *config = text_to_cstring(DatumGetTextPCopy(configs[i]));
char *config = TextDatumGetCString(configs[i]);
stmt->setstmt = MakeVariableSetStmt(config);
commandList = lappend(commandList,
(void *) CreateAlterRoleSetIfExistsCommand(stmt));

View File

@ -207,7 +207,6 @@ GetTextSearchDictionaryInitOptions(HeapTuple tup, Form_pg_ts_dict dict)
List *initOptionDefElemList = NIL;
if (!isnull)
{
/* TODO: might need copying */
initOptionDefElemList = deserialize_deflist(dictinitoption);
}

View File

@ -152,7 +152,7 @@ get_extension_version(Oid extensionId)
RelationGetDescr(relation), &isNull);
if (!isNull)
{
versionName = text_to_cstring(DatumGetTextPCopy(versionDatum));
versionName = text_to_cstring(DatumGetTextPP(versionDatum));
}
}

View File

@ -67,7 +67,6 @@
#include "utils/datum.h"
#include "utils/elog.h"
#include "utils/hsearch.h"
#include "utils/jsonb.h"
#if PG_VERSION_NUM >= PG_VERSION_13
#include "common/hashfn.h"
#endif
@ -2250,7 +2249,7 @@ InstalledExtensionVersion(void)
MemoryContext oldMemoryContext = MemoryContextSwitchTo(
MetadataCacheMemoryContext);
installedExtensionVersion = text_to_cstring(DatumGetTextPCopy(installedVersion));
installedExtensionVersion = text_to_cstring(DatumGetTextPP(installedVersion));
MemoryContextSwitchTo(oldMemoryContext);
}
@ -4884,10 +4883,6 @@ DistNodeMetadata(void)
"could not find any entries in pg_dist_metadata")));
}
/* copy the jsonb result before closing the table */
/* since that memory can be freed */
metadata = JsonbPGetDatum(DatumGetJsonbPCopy(metadata));
systable_endscan(scanDescriptor);
table_close(pgDistNodeMetadata, AccessShareLock);

View File

@ -1286,7 +1286,6 @@ ExplainAnalyzeDestPutTuple(TupleDestination *self, Task *task,
return;
}
/* TODO: might need copying */
char *fetchedExplainAnalyzePlan = TextDatumGetCString(explainAnalyze);
double fetchedExplainAnalyzeExecutionDuration = DatumGetFloat8(executionDuration);