Skip to content

Conversation

@bjornharrtell
Copy link

Attempt to implement a DbFunction to translate into PostGIS && operator.

Not working yet.

@bjornharrtell
Copy link
Author

bjornharrtell commented Mar 1, 2025

I'm getting test failure:

Npgsql.EntityFrameworkCore.PostgreSQL.Query.SpatialQueryNpgsqlGeometryTest.IntersectsBbox(async: False) (24ms): Error Message: System.InvalidOperationException : The 'IntersectsBbox' method is not supported because the query has switched to client-evaluation. This usually happens when the arguments to the method cannot be
translated to server. Rewrite the query to avoid client evaluation of arguments so that method can be translated to server.

But at the same time I see:

SQL sent to the database:
       @__polygon_1='POLYGON ((0 0, 1 0, 0 1, 0 0))' (DbType = Object)
       
       SELECT p."Id", p."Polygon" && @__polygon_1 AS "IntersectsBbox"
       FROM "PolygonEntity" AS p

The generated SQL looks fine... so I'm quite confused about why the test is failing with what looks like something that should block SQL generation!?

@bjornharrtell
Copy link
Author

I understand now, in the case of DbFunction extensions I need to emulate a client side query in the test case. Should be foxed now.

@bjornharrtell bjornharrtell marked this pull request as ready for review March 1, 2025 15:28
@bjornharrtell bjornharrtell changed the title Attempt to implement IntersectsBbox Implement IntersectsBbox to translate PostGIS && operator Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant