@@ -70,7 +70,7 @@ static Datum get_vertex(Oid graph_oid, int64 graphid, bool *isnull)
7070 ereport (ERROR , (errcode (ERRCODE_UNDEFINED_TABLE ), errmsg ("id %lu does not exist" , graphid )));
7171
7272 Datum properties = heap_getattr (tuple , 2 , RelationGetDescr (rel ), isnull );
73-
73+ //*isnull = false;
7474 table_endscan (scan_desc );
7575 table_close (rel , ShareLock );
7676
@@ -79,6 +79,38 @@ static Datum get_vertex(Oid graph_oid, int64 graphid, bool *isnull)
7979
8080
8181
82+ PG_FUNCTION_INFO_V1 (retrieve_vertex );
83+ Datum retrieve_vertex (PG_FUNCTION_ARGS ) {
84+ Oid graph_oid = GT_ARG_TO_INT4_DATUM (0 );
85+ int64 graphid = AG_GETARG_GRAPHID (1 );
86+ bool isnull ;
87+
88+ label_cache_data * lcd = search_label_graph_oid_cache (graph_oid , (graphid >> ENTRY_ID_BITS ));
89+
90+ ScanKeyData scan_keys [1 ];
91+ ScanKeyInit (& scan_keys [0 ], 1 , BTEqualStrategyNumber , F_OIDEQ , Int64GetDatum (graphid ));
92+
93+ Relation rel = table_open (lcd -> relation , ShareLock );
94+
95+ TableScanDesc scan_desc = table_beginscan (rel , GetActiveSnapshot (), 1 , scan_keys );
96+
97+ HeapTuple tuple ;
98+ if (!HeapTupleIsValid (tuple = heap_getnext (scan_desc , ForwardScanDirection )))
99+ ereport (ERROR , (errcode (ERRCODE_UNDEFINED_TABLE ), errmsg ("id %lu does not exist" , graphid )));
100+
101+ Datum properties = heap_getattr (tuple , 2 , RelationGetDescr (rel ), & isnull );
102+
103+ table_endscan (scan_desc );
104+ table_close (rel , ShareLock );
105+
106+ if (isnull )
107+ PG_RETURN_NULL ();
108+
109+ AG_RETURN_GTYPE_P (properties );
110+
111+ }
112+
113+ /*
82114PG_FUNCTION_INFO_V1(retrieve_vertex);
83115Datum retrieve_vertex(PG_FUNCTION_ARGS) {
84116
@@ -100,7 +132,7 @@ Datum retrieve_vertex(PG_FUNCTION_ARGS) {
100132
101133 SRF_RETURN_DONE(funcctx);
102134}
103-
135+ */
104136
105137typedef struct edge_search_cxt
106138{
0 commit comments