pgsql 生成 PartitionBy 为group by 的bug 返回

C#论坛 老数据
1 1696

以下为查询

  var or = context.Queryable<ASNFormDetail, ASNForm, OpenPO>((afd, af, op) => op.PO == afd.PONO && op.PN == afd.PartNo

              && afd.FormID == af.FormID

                )

                .Where((afd, af, op) => op.BuyerCode == buyerCode)

                .WhereIF(!String.IsNullOrEmpty(formNo), (afd, af) => af.FormNo == formNo)

                .WhereIF(!String.IsNullOrEmpty(partNo), (afd, af) => afd.PartNo == partNo)

                .WhereIF(!String.IsNullOrEmpty(poNo), (afd, af) => afd.PONO == poNo)

                .Select((afd, af) => new

                {

                    FormID = afd.FormID,

                    FormNo = af.FormNo,

                    PONO = afd.PONO,

                    PartNo = afd.PartNo,

                    COO = afd.COO,

                    ECCN = afd.ECCN,

                    QTY = afd.QTY,

                    CartonNo = afd.CartonNo,

                    CartonQty = afd.CartonQty,

                    PalletNo = afd.PalletNo,

                    PalletQTY = afd.PalletQTY,

                    COOCert = afd.COOCert,

                    Specifiation = afd.Specifiation,

                    BrandName = afd.BrandName

                })

                .PartitionBy(afd => new { afd.FormID, afd.PartNo, afd.PONO }).Take(1);


生成的sql :

   SELECT  "afd"."formid" AS "formid" , "af"."formno" AS "formno" , "afd"."pono" AS "pono" , "afd"."partno" AS "partno" , "afd"."coo" AS "coo" , "afd"."eccn" AS "eccn" , "afd"."qty" AS "qty" , "afd"."cartonno" AS "cartonno" , "afd"."cartonqty" AS "cartonqty" , "afd"."palletno" AS "palletno" , "afd"."palletqty" AS "palletqty" , "afd"."coocert" AS "coocert" , "afd"."specifiation" AS "specifiation" , "afd"."brandname" AS "brandname"  FROM "form_asn_detail" afd  ,"form_asn"  af ,"md_openpo"  op   WHERE ((( "op"."po" = "afd"."pono" ) AND ( "op"."pn" = "afd"."partno" )) AND ( "afd"."formid" = "af"."formid" ))  AND ( "op"."buyercode" = @BuyerCode0 ) GROUP BY "afd"."formid","afd"."partno","afd"."pono"   LIMIT 1 offset 0


由于PartitionBy变成group by 了所以查询出错,请修正. 版本是 用的最新版本的5.0.0.15 

热忱回答1