0 Replies Latest reply on Oct 14, 2019 8:12 AM by ddd1e253-fbc5-4de0-8f75-793144a5cf54

    Sql generated using oData

    ddd1e253-fbc5-4de0-8f75-793144a5cf54

      When using oData's "countdistinct" in my request http://page/route?$apply=aggregate(prop with countdistinct as result)

      following sql is generated:

       

      SELECT 
      1 AS "C1", 
      'result' AS "C2", 
      "Project3"."C1" AS "C3"
      FROM ( SELECT 
           (SELECT 
                COUNT(1) AS "A1"
                FROM ( SELECT DISTINCT 
                     "Extent2"."PROP" AS "PROP"
                     FROM "SCHEMA"."TABLE" "Extent2"
                     WHERE ("Distinct1"."C1" = 1)
                )  "Distinct2") AS "C1"
           FROM ( SELECT DISTINCT 
                1 AS "C1"
                FROM "SCHEMA"."TABLE" "Extent1"
           )  "Distinct1"
      )  "Project3"
      

       

      That throws an error

      ORA-00904: "Distinct1"."C1": invalid identifier

      If  WHERE clause is removed everything works fine and results are valid.

       

      Environment:

      Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

       

      EntityFramework 6.2.0

      Oracle.ManagedDataAccess 12.2.1100

      Oracle.ManagedDataAccess.EntityFramework 12.2.110

       

      Microsoft.Data.Odata 5.8.3

      Microsoft.OData.Core 7.4.4

      Microsoft.OData.Edm 7.4.4

      Microsoft.AspNet.OData 6.1.0

       

      Tried:

      Updating packages- -> did not work
      Connecting to database other then Oracle and use "countdistinct" -> it works fine.