querybuilder
querybuilder copied to clipboard
.Include and .IncludeMany does not work with Guid keys in Postgres databases
Hi,
When i use include method in postgres database with primary keys as guid i get the following error:
operator does not exist: uuid = text
I think the problem is here https://github.com/sqlkata/querybuilder/blob/d098a4ea288819e06fc382ce54e47f335a6b78b9/SqlKata.Execution/QueryFactory.Extensions.Async.cs#L344
instead of
.Select(x => x[include.LocalKey].ToString())
may be
.Select(x => x[include.LocalKey]);
Do u have workaround for Include in Postgresql?
Yes that's true, can you make a PR for it?
Hi @ahmad-moussawi, I try to use Include feature, see example
db.Query("environment").Where("siteenvironmentid", UserEnvironmentId).IncludeMany("Organizations", db.Query("organization"), "environmentid", "siteenvironmentid");
it generates this sql statements SELECT * FROM "environment" WHERE "siteenvironmentid" = 1 SELECT * FROM "organization" WHERE "environmentid" IN ('1')
So it does not work because the second SELECT converts integers to strings Is it bug or I do something wrong? Thanks
there is a pr about that issue (see https://github.com/sqlkata/querybuilder/pull/494), why you don't merge this pr to solve this issue?
Would love if this gets solved