You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, first or all, thank you for all the efforts put into this library.
We're in the middle of trying to migrate our codebase from MSSQL to PostgreSQL, and have some difficoulties around bulk operations.
Before anything else, I'd like to emphasize that we're on .NET version 6, including related framework packages (EFCore, EFCore.Bulkextensions, etc. Namely we're using version 6.8.1 from bulk extensions. Unfortunately this is a hard constraint and we cannot put the huge efforts into upgrading to latest, or even to 7.x.
Type Coordinates is an owned type by Address, so it maps to columns like coordinates_x and so.
When calling BulkInsert on companies (using IncludeGraph), we get the following query in one of the commands, which produces syntax error at or near "INTO" SQL exception.
SELECTk.id, k.buildingnumber, t.id, t.coordinates_srid, t.coordinates_x, t.coordinates_yFROM (
INSERT INTO"public"."address" ("buildingnumber", "coordinates_srid", "coordinates_x", "coordinates_y") (SELECT"buildingnumber", "coordinates_srid", "coordinates_x", "coordinates_y"FROM"public"."addressTemp251c599b") ON CONFLICT ("id") DO UPDATESET"buildingnumber"= EXCLUDED."buildingnumber", "coordinates_srid"= EXCLUDED."coordinates_srid", "coordinates_x"= EXCLUDED."coordinates_x", "coordinates_y"= EXCLUDED."coordinates_y" RETURNING "public"."address"."id", "public"."address"."buildingnumber", "public"."address"."coordinates_srid", "public"."address"."coordinates_x", "public"."address"."coordinates_y"
) AS k
LEFT JOIN (
SELECTa.id, a.coordinates_srid, a.coordinates_x, a.coordinates_yFROMpublic.addressAS a
INNER JOINpublic.addressAS a0 ONa.id=a0.idWHERE (((a.coordinates_sridIS NOT NULL)) AND ((a.coordinates_xIS NOT NULL))) AND ((a.coordinates_yIS NOT NULL))
) AS t ONk.id= CASE
WHEN (((t.coordinates_sridIS NOT NULL)) AND ((t.coordinates_xIS NOT NULL))) AND ((t.coordinates_yIS NOT NULL)) THEN t.id
END
One thing is that it has a syntax error regarding the SELECT .... FROM (INSERT INTO ...) structure.
Another strange thing is that it seems like the library does not properly handle owned types, the join to self seems unnecessary at first glance.
Any tips or advices are highly appreciated, thank you in advance.
The text was updated successfully, but these errors were encountered:
Just as an addition, it seems like the key here is not the IncludeGraph option, but the SetOutputIdentity = true option (which I guess is set implicitly when using IncludeGraph). The issue is reproducible by trying to bulk-insert addresses with SetOutputIdentity = true. I've also tried IgnoreGlobalQueryFilters = true option (found in another, possibly related issue), but it makes no difference. In my case I don't even have a global filter on this table (Address)
Hi, first or all, thank you for all the efforts put into this library.
We're in the middle of trying to migrate our codebase from MSSQL to PostgreSQL, and have some difficoulties around bulk operations.
Before anything else, I'd like to emphasize that we're on .NET version 6, including related framework packages (
EFCore
,EFCore.Bulkextensions
, etc. Namely we're using version6.8.1
from bulk extensions. Unfortunately this is a hard constraint and we cannot put the huge efforts into upgrading to latest, or even to7.x
.We have a model similar to this (simplified)
Type
Coordinates
is an owned type byAddress
, so it maps to columns likecoordinates_x
and so.When calling
BulkInsert
on companies (using IncludeGraph), we get the following query in one of the commands, which producessyntax error at or near "INTO"
SQL exception.SELECT .... FROM (INSERT INTO ...)
structure.Any tips or advices are highly appreciated, thank you in advance.
The text was updated successfully, but these errors were encountered: