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

   I think I might have found a clue for this, sorta. In the 
[GetResultRTEPermissionInfo](https://github.com/postgres/postgres/blob/0a1d2a7df852f16c452eef8a83003943125162c7/src/backend/executor/execUtils.c#L1375)
 function, the `Index rti` variable is storing 0, but actually it needs to get 
the the root parent's RTE to fetch the RTEPermissionInfo. 
   
   ```c
          if (relinfo->ri_RootResultRelInfo)
        {
                /*
                 * For inheritance child result relations (a partition routing 
target
                 * of an INSERT or a child UPDATE target), this returns the root
                 * parent's RTE to fetch the RTEPermissionInfo because that's 
the only
                 * one that has one assigned.
                 */
                rti = relinfo->ri_RootResultRelInfo->ri_RangeTableIndex;
        }
   ```
   The `relinfo` contains:
   ```
   {type = T_ResultRelInfo, ri_RangeTableIndex = 5, ri_RelationDesc = 
0x7f44e3308cc8, ri_NumIndices = 0, ri_IndexRelationDescs = 0x0, 
ri_IndexRelationInfo = 0x0, ri_RowIdAttNo = 0, 
     ri_extraUpdatedCols = 0x0, ri_projectNew = 0x0, ri_newTupleSlot = 0x0, 
ri_oldTupleSlot = 0x0, ri_projectNewInfoValid = false, ri_TrigDesc = 0x0, 
ri_TrigFunctions = 0x0, 
     ri_TrigWhenExprs = 0x0, ri_TrigInstrument = 0x0, ri_ReturningSlot = 0x0, 
ri_TrigOldSlot = 0x0, ri_TrigNewSlot = 0x0, ri_FdwRoutine = 0x0, ri_FdwState = 
0x0, 
     ri_usesFdwDirectModify = false, ri_NumSlots = 0, ri_NumSlotsInitialized = 
0, ri_BatchSize = 0, ri_Slots = 0x0, ri_PlanSlots = 0x0, ri_WithCheckOptions = 
0x0, 
     ri_WithCheckOptionExprs = 0x0, ri_ConstraintExprs = 0x0, 
ri_GeneratedExprsI = 0x0, ri_GeneratedExprsU = 0x0, ri_NumGeneratedNeededI = 0, 
ri_NumGeneratedNeededU = 0, 
     ri_returningList = 0x0, ri_projectReturning = 0x0, 
ri_onConflictArbiterIndexes = 0x0, ri_onConflict = 0x0, ri_matchedMergeAction = 
0x0, ri_notMatchedMergeAction = 0x0, 
     ri_PartitionCheckExpr = 0x0, ri_ChildToRootMap = 0x0, 
ri_ChildToRootMapValid = false, ri_RootToChildMap = 0x0, ri_RootToChildMapValid 
= false, ri_RootResultRelInfo = 0x0, 
     ri_PartitionTupleSlot = 0x0, ri_CopyMultiInsertBuffer = 0x0, 
ri_ancestorResultRels = 0x0}
   ```
   
   And since `relinfo->ri_RootResultRelInfo = 0x0`, the `rti` will have no 
value and Postgres will interpret that the `ResultRelInfo` must've been created 
only for filtering triggers and the relation is not being inserted into (which 
is not the case). Therefore, this variable must contain a value somehow.


-- 
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