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 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. * 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); stmt->constraints = lappend(stmt->constraints, constraint);
} }

View File

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

View File

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

View File

@ -152,7 +152,7 @@ get_extension_version(Oid extensionId)
RelationGetDescr(relation), &isNull); RelationGetDescr(relation), &isNull);
if (!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/datum.h"
#include "utils/elog.h" #include "utils/elog.h"
#include "utils/hsearch.h" #include "utils/hsearch.h"
#include "utils/jsonb.h"
#if PG_VERSION_NUM >= PG_VERSION_13 #if PG_VERSION_NUM >= PG_VERSION_13
#include "common/hashfn.h" #include "common/hashfn.h"
#endif #endif
@ -2250,7 +2249,7 @@ InstalledExtensionVersion(void)
MemoryContext oldMemoryContext = MemoryContextSwitchTo( MemoryContext oldMemoryContext = MemoryContextSwitchTo(
MetadataCacheMemoryContext); MetadataCacheMemoryContext);
installedExtensionVersion = text_to_cstring(DatumGetTextPCopy(installedVersion)); installedExtensionVersion = text_to_cstring(DatumGetTextPP(installedVersion));
MemoryContextSwitchTo(oldMemoryContext); MemoryContextSwitchTo(oldMemoryContext);
} }
@ -4884,10 +4883,6 @@ DistNodeMetadata(void)
"could not find any entries in pg_dist_metadata"))); "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); systable_endscan(scanDescriptor);
table_close(pgDistNodeMetadata, AccessShareLock); table_close(pgDistNodeMetadata, AccessShareLock);

View File

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