Skip to content

Implement IntersectsBbox to translate PostGIS && operator #3484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: hotfix/9.0.5
Choose a base branch
from

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