Skip to content
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

PostGIS 3.1+ support #129

Closed
peetw opened this issue Aug 14, 2022 · 4 comments
Closed

PostGIS 3.1+ support #129

peetw opened this issue Aug 14, 2022 · 4 comments

Comments

@peetw
Copy link
Collaborator

peetw commented Aug 14, 2022

Running the Tests.NHibernate.Spatial.PostGis20 tests with PostGIS 3.1+ fails with the following error:

OneTimeSetUp: NHibernate.HibernateException : 42883: function st_intersection(geometry, geometry) does not exist
  ----> Npgsql.PostgresException : 42883: function st_intersection(geometry, geometry) does not exist
Data:
  Severity: ERROR
  SqlState: 42883
  Code: 42883
  MessageText: function st_intersection(geometry, geometry) does not exist
  File: d:\pginstaller_12.auto\postgres.windows-x64\src\backend\catalog\pg_aggregate.c
  Line: 871
  Routine: lookup_agg_function
@peetw
Copy link
Collaborator Author

peetw commented Aug 14, 2022

Seems to be caused by the following SQL statement:

CREATE AGGREGATE NHSP_IntersectionAggregate(BASETYPE=GEOMETRY, SFUNC=ST_Intersection, STYPE=GEOMETRY);

@peetw
Copy link
Collaborator Author

peetw commented Aug 15, 2022

The error is caused by the fact that the signature for ST_Intersection changed in PostGIS 3.1 - it now has an optional gridSize parameter (see here and here). Therefore, will need to conditionally create a wrapper around the new function depending on the PostGIS version.

@peetw
Copy link
Collaborator Author

peetw commented Aug 15, 2022

Fixing the intersection aggregate issue reveals that tests ConformanceItemT48Hql and ConformanceItemT48Linq are also failing with PostGIS 3.1, but this looks to be due to the ordering of the returned polygon co-ordinates - using EqualsTopologically rather than EqualsExact resolves the issue

peetw pushed a commit to peetw/NHibernate.Spatial that referenced this issue Aug 15, 2022
@peetw peetw closed this as completed Aug 15, 2022
@andrerav
Copy link
Contributor

Great work @peetw! 🙏

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

No branches or pull requests

2 participants