MatheusFarias03 commented on issue #1055:
URL: https://github.com/apache/age/issues/1055#issuecomment-1644698381

   PostgreSQL defines the following for the `ResultRelInfo` struct's 
`ri_RootResultRelInfo` member:
   
   ```c
          /*
         * Information needed by tuple routing target relations
         *
         * RootResultRelInfo gives the target relation mentioned in the query, 
if
         * it's a partitioned table. It is not set if the target relation
         * mentioned in the query is an inherited table, nor when tuple routing 
is
         * not needed.
         *
         * PartitionTupleSlot is non-NULL if RootToChild conversion is needed 
and
         * the relation is a partition.
         */
        struct ResultRelInfo *ri_RootResultRelInfo;
        TupleTableSlot *ri_PartitionTupleSlot;
   ```
   
   We need the `RootResultRelInfo` member with some value, but postgres states 
that it is not to be set if the target relation mentioned in the query is an 
inherited table...
   
   With further inspection, we can see that AGE initializes `resultRelInfo` 
with 
[`create_entity_result_rel_info()`](https://github.com/apache/age/blob/d684cd55699b987a0c6efdb1c065f5ea1f8c915d/src/backend/executor/cypher_utils.c#L56).
 This function then calls 
[`InitResultRelInfo()`](https://github.com/postgres/postgres/blob/9089287aa037fdecb5a52cec1926e5ae9569e9f9/src/backend/executor/execMain.c#L1225),
 which has a special comment there for the `ri_RootResultRelInfo` member:
   
   ```c
        /*
         * Only ExecInitPartitionInfo() and ExecInitPartitionDispatchInfo() pass
         * non-NULL partition_root_rri.  For child relations that are part of 
the
         * initial query rather than being dynamically added by tuple routing,
         * this field is filled in ExecInitModifyTable().
         */
        resultRelInfo->ri_RootResultRelInfo = partition_root_rri;
   ``` 
   Maybe we should use `ExecInitModifyTable()`? Because the relation that we 
want to modify is the child relation from `_ag_label_vertex`. I just don't 
quite yet know how to use it, and I haven't found anywhere in the code that 
uses the  `ModifyTableState` struct, which is the return type of the function.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@age.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to