This is an automated email from the ASF dual-hosted git repository.
jgemignani pushed a commit to branch PG14
in repository https://gitbox.apache.org/repos/asf/age.git
The following commit(s) were added to refs/heads/PG14 by this push:
new 189050b7 Fix issue #1347 - unknow type of agtype container 0 (#1350)
189050b7 is described below
commit 189050b7994f44d78732ceed576463cb245d851b
Author: Rafsun Masud <[email protected]>
AuthorDate: Fri Nov 3 16:26:48 2023 -0700
Fix issue #1347 - unknow type of agtype container 0 (#1350)
The error was caused by the Datum referenced by
edge_entry->edge_properties becoming non-persistent. As a
result, the pointer becomes dangling. This issue is fixed
by making a copy of the Datum into the MemoryContext it is
used. The fix is also applied to
vertex_entry->vertex_properties.
Thanks to John for finding out the correct function to
copy a Datum.
Co-authored-by: John Gemignani <[email protected]>
---
src/backend/utils/adt/age_global_graph.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/backend/utils/adt/age_global_graph.c
b/src/backend/utils/adt/age_global_graph.c
index fec67615..240e1367 100644
--- a/src/backend/utils/adt/age_global_graph.c
+++ b/src/backend/utils/adt/age_global_graph.c
@@ -25,13 +25,13 @@
#include "access/table.h"
#include "access/tableam.h"
#include "catalog/namespace.h"
+#include "common/hashfn.h"
#include "commands/label_commands.h"
+#include "utils/datum.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
-#include "commands/label_commands.h"
-#include "common/hashfn.h"
#include "catalog/ag_graph.h"
#include "catalog/ag_label.h"
@@ -448,6 +448,8 @@ static void load_vertex_hashtable(GRAPH_global_context
*ggctx)
/* get the vertex properties datum */
vertex_properties = column_get_datum(tupdesc, tuple, 1,
"properties", AGTYPEOID,
true);
+ /* we need to make a copy of the properties datum */
+ vertex_properties = datumCopy(vertex_properties, false, -1);
/* insert vertex into vertex hashtable */
inserted = insert_vertex_entry(ggctx, vertex_id,
@@ -561,6 +563,9 @@ static void load_edge_hashtable(GRAPH_global_context *ggctx)
edge_properties = column_get_datum(tupdesc, tuple, 3, "properties",
AGTYPEOID, true);
+ /* we need to make a copy of the properties datum */
+ edge_properties = datumCopy(edge_properties, false, -1);
+
/* insert edge into edge hashtable */
inserted = insert_edge(ggctx, edge_id, edge_properties,
edge_vertex_start_id, edge_vertex_end_id,