@@ -194,7 +194,6 @@ static void begin_cypher_create(CustomScanState *node, EState *estate, int eflag
194194 // Open all indexes for the relation
195195 ExecOpenIndices (cypher_node -> resultRelInfo , false);
196196
197-
198197 // Setup the relation's tuple slot
199198 cypher_node -> elemTupleSlot = table_slot_create (rel , & estate -> es_tupleTable );
200199
@@ -290,9 +289,6 @@ static TupleTableSlot *exec_cypher_create(CustomScanState *csnode)
290289
291290 }
292291
293-
294- //TODO: the edges aren't setup to use this. I gotta get the correct relid in cypher_target_node.
295- // Then I gotta get any existing tuple, and update it if it exists, and insert if it doesn't
296292 for (int i = 0 ; i < list_length (path -> target_nodes )/2 + 1 ; i ++ ) {
297293 cypher_target_node * node = (cypher_target_node * )list_nth (path -> target_nodes , i * 2 );
298294
@@ -330,9 +326,15 @@ static TupleTableSlot *exec_cypher_create(CustomScanState *csnode)
330326 elemTupleSlot -> tts_values [0 ] = css -> edge_ids [0 ][i ];
331327 elemTupleSlot -> tts_isnull [0 ] = false;
332328
329+ elemTupleSlot -> tts_values [1 ] = css -> vertex_ids [0 ][i ];
330+ elemTupleSlot -> tts_isnull [1 ] = false;
331+
332+ elemTupleSlot -> tts_values [2 ] = css -> vertex_ids [0 ][i + 1 ];
333+ elemTupleSlot -> tts_isnull [2 ] = false;
333334 // get the properties for this vertex
334- elemTupleSlot -> tts_values [1 ] = NULL ;
335- elemTupleSlot -> tts_isnull [1 ] = true;
335+ elemTupleSlot -> tts_values [3 ] = NULL ;
336+ elemTupleSlot -> tts_isnull [3 ] = true;
337+
336338 // Insert the new vertex
337339 insert_entity_tuple (resultRelInfo , elemTupleSlot , estate );
338340 }
@@ -364,8 +366,12 @@ static void end_cypher_create(CustomScanState *node)
364366 continue ;
365367
366368 ExecCloseIndices (cypher_node -> resultRelInfo );
369+ table_close (cypher_node -> resultRelInfo -> ri_RelationDesc , RowExclusiveLock );
367370 ExecCloseIndices (cypher_node -> adj_resultRelInfo );
368371 table_close (cypher_node -> adj_resultRelInfo -> ri_RelationDesc , RowExclusiveLock );
372+
373+
374+
369375 }
370376 }
371377}
@@ -454,8 +460,6 @@ static void insert_vertex(cypher_create_custom_scan_state *css,
454460/*
455461 * Insert the edge/vertex tuple into the table and indices. Check that the
456462 * table's constraints have not been violated.
457- *
458- * This function uses the passed cid for updates.
459463 */
460464HeapTuple insert_entity_tuple (ResultRelInfo * resultRelInfo ,
461465 TupleTableSlot * elemTupleSlot ,
@@ -464,14 +468,14 @@ HeapTuple insert_entity_tuple(ResultRelInfo *resultRelInfo,
464468 HeapTuple tuple = NULL ;
465469
466470 ExecStoreVirtualTuple (elemTupleSlot );
467- tuple = ExecFetchSlotHeapTuple (elemTupleSlot , true, NULL );
471+ // tuple = ExecFetchSlotHeapTuple(elemTupleSlot, true, NULL);
468472
469473 /* Check the constraints of the tuple */
470- tuple -> t_tableOid = RelationGetRelid ( resultRelInfo -> ri_RelationDesc ) ;
471- if (resultRelInfo -> ri_RelationDesc -> rd_att -> constr != NULL )
474+ // tuple->t_tableOid = resultRelInfo->ri_RelationDesc->rd_id ;
475+ /* if (resultRelInfo->ri_RelationDesc->rd_att->constr != NULL)
472476 {
473477 ExecConstraints(resultRelInfo, elemTupleSlot, estate);
474- }
478+ }*/
475479
476480 // Insert the tuple normally
477481 table_tuple_insert (resultRelInfo -> ri_RelationDesc , elemTupleSlot , estate -> es_output_cid , 0 , NULL );
@@ -482,7 +486,7 @@ HeapTuple insert_entity_tuple(ResultRelInfo *resultRelInfo,
482486 ExecInsertIndexTuples (resultRelInfo , elemTupleSlot , estate , false, false, NULL , NIL );
483487 }
484488
485- return tuple ;
489+ return NULL ;
486490}
487491
488492
0 commit comments