IITDBGroup / gprom

GProM is a middleware that adds support for provenance to database backends.
http://www.cs.iit.edu/%7edbgroup/research/gprom.php
Apache License 2.0
8 stars 5 forks source link

Outerlevels up for join condition attribute incorrect #102

Closed lordpretzel closed 11 months ago

lordpretzel commented 12 months ago

When a nested query contains a join, then the attributes referenced in the join condition do not get correctly set (test in branch . An example

SELECT * FROM r WHERE EXISTS (SELECT x.a FROM r x JOIN r y ON (x.a = y.a));
DEBUG(analyze_oracle.c:927) finished adapting attr refs in join conds:

(
  {FROMJOINEXPR
    name: "(null)"
    attrNames: (
      "A" "B" "A" "B"
    )
    provInfo: <>
    dataTypes: (i0 i0 i0 i0
    )
    left:
    {FROMTABLEREF
      name: "X"
      attrNames: (
        "A" "B"
      )
      provInfo: <>
      dataTypes: (i0 i0
      )
      tableId: "R"
    }
    right:
    {FROMTABLEREF
      name: "Y"
      attrNames: (
        "A" "B"
      )
      provInfo: <>
      dataTypes: (i0 i0
      )
      tableId: "R"
    }
    joinType: JOIN_INNER - 0
    joinCond: JOIN_COND_ON - 0
    cond:
    {OPERATOR
      name: "="
      args: (
        {ATTRIBUTE_REFERENCE
          name: "A"
          fromClauseItem: 0
          attrPosition: 0
          outerLevelsUp: 1
          attrType: DT_INT - 0
        }
        {ATTRIBUTE_REFERENCE
          name: "A"
          fromClauseItem: 1
          attrPosition: 0
          outerLevelsUp: 1
          attrType: DT_INT - 0
        }
      )
    }
  }
)