7 Replies Latest reply on Oct 20, 2017 1:41 PM by Steven Hawkins

    Set operations and parenthesis

    Mike Higgins Newbie

      Using Teiid 9.2.2 with postgresql, I issue a query structured like this:

       

      (a

      UNION ALL

      b

      UNION ALL

      c)

      INTERSECT

      d

       

      All queries are from a single database.

      This query does not give back the expected result.  In the plan, I see the query printed with no parenthesis around the unions:

      a UNION ALL b UNION ALL c INTERSECT d

       

      which in the case of Postgresql (or Teiid, for that matter) is interpreted as:

       

      a UNION ALL b UNION ALL (c INTERSECT d)

       

      I did try changing the 'union all' to 'union' (which makes more sense) but it had the same result (except for duplicate removal of course).

      I don't see any references to this type of problem in the issues or forum.  is there any setting that I could do to make sure the

      parens are preserved?  Or am I doing something else wrong that you can think of?