Hi,
After updating npgsql from version 2.2.4.1 to 3.2.5 following code doesn't work any longer.
var q = from p in metaData.PracticePageVisit
group p by new
{
Time = MyFunctions.DateTrunc("hour", p.DateCreated),
} into g
orderby g.Key.Time
select new PracticePageVisitCounts
{
Count = g.Count(),
Time = g.Key.Time,
};
I also tried with FetchTypedListAsync, same error.
Error is actually from Npgsql/PostgreSQL:
"42803: column "LPLA_1.DateCreated" must appear in the GROUP BY clause or be used in an aggregate function"
Routine: "check_ungrouped_columns_walker"
Issue seems to be with sending two different parameters, p2 in select and p6 in group by. There is one more parameter p4 and it's not used anywhere.
I tried sending same parameter two both select and group by and it works. I did that by using npgsql directly, I'm not sure how to do that with LLBLGen.
Generated sql:
Query: SELECT "LPA_L1"."LPAV_" AS "Count", "LPA_L1"."Time" FROM (SELECT date_trunc(:p2, "LPLA_1"."DateCreated") AS "Time", COUNT(*) AS "LPAV_" FROM "public"."PracticePageVisit" "LPLA_1" GROUP BY date_trunc(:p6, "LPLA_1"."DateCreated")) "LPA_L1" ORDER BY "LPA_L1"."Time" ASC
Parameter: :p2 : String. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: "hour".
Parameter: :p4 : String. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: "hour".
Parameter: :p6 : String. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: "hour".
Postgresql 9.4
LLBLGen 4.2
Thank you for your help,
David.