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

spoly that was valid now detected as invalid #112

Closed
pdowler opened this issue Dec 1, 2023 · 2 comments · Fixed by #113
Closed

spoly that was valid now detected as invalid #112

pdowler opened this issue Dec 1, 2023 · 2 comments · Fixed by #113
Assignees

Comments

@pdowler
Copy link
Contributor

pdowler commented Dec 1, 2023

I have a polygon from an existing server that later versions of pgsphere detect as invalid.

Summary: The polygon below is acceptable in pgsphere up to 1.2.3 and then rejected by 1.3.1 and 1.4.1.

psql (15.4, server 15.5)
Type "help" for help.

content=> select pg_sphere_version();
 pg_sphere_version 
-------------------
 1.2.3
(1 row)

content=> select '{
(3.30474723646012 , 1.08600456205300),
(3.30341855309927 , 1.08577960186707),
(3.30341054542378 , 1.08578643990271),
(3.30297351563319 , 1.08633534556428),
(3.30357156120003 , 1.08643683957210),
(3.30358891855857 , 1.08643995044436),
(3.30360894676365 , 1.08644306147078),
(3.30361829343581 , 1.08644430596871),
(3.30362630482521 , 1.08644555030213),
(3.30364633346451 , 1.08644866102000),
(3.30365300940335 , 1.08645052692055),
(3.30366102096957 , 1.08645177113937),
(3.30367036769496 , 1.08645363721023),
(3.30367837934959 , 1.08645488137174),
(3.30368906174976 , 1.08645612569695),
(3.30370107936906 , 1.08645799183673),
(3.30370642025712 , 1.08645985750225),
(3.30373179124734 , 1.08646358962156),
(3.30374514456618 , 1.08646545561358),
(3.30410706158729 , 1.08652886672786),
(3.30427803417922 , 1.08655868846497),
(3.30429673329093 , 1.08655930694968),
(3.30432478121775 , 1.08655930174652),
(3.30433278932944 , 1.08655308246640),
(3.30446348355532 , 1.08638330933224)
}'::spoly;

spoly                                                                                             
--------
 {(3.30474723646012 , 1.086004562053),(3.30341855309927 , 1.08577960186707),(3.30341054542378 , 1.08578643990271),(3.30297351563319 , 1.086335
34556428),(3.30357156120003 , 1.0864368395721),(3.30358891855857 , 1.08643995044436),(3.30360894676365 , 1.08644306147078),(3.30361829343581 ,
 1.08644430596871),(3.30362630482521 , 1.08644555030213),(3.30364633346451 , 1.08644866102),(3.30365300940335 , 1.08645052692055),(3.303661020
96957 , 1.08645177113937),(3.30367036769496 , 1.08645363721023),(3.30367837934959 , 1.08645488137174),(3.30368906174976 , 1.08645612569695),(3
.30370107936906 , 1.08645799183673),(3.30370642025712 , 1.08645985750225),(3.30373179124734 , 1.08646358962156),(3.30374514456618 , 1.08646545
561358),(3.30410706158729 , 1.08652886672786),(3.30427803417922 , 1.08655868846497),(3.30429673329093 , 1.08655930694968),(3.30432478121775 , 
1.08655930174652),(3.30433278932944 , 1.0865530824664),(3.30446348355532 , 1.08638330933224)}
(1 row)

the failures:

psql (15.4, server 15.5)
Type "help" for help.

content=> select pg_sphere_version();
 pg_sphere_version 
-------------------
 1.3.1
(1 row)

content=> select '{
(3.30474723646012 , 1.08600456205300),
(3.30341855309927 , 1.08577960186707),
(3.30341054542378 , 1.08578643990271),
(3.30297351563319 , 1.08633534556428),
(3.30357156120003 , 1.08643683957210),
(3.30358891855857 , 1.08643995044436),
(3.30360894676365 , 1.08644306147078),
(3.30361829343581 , 1.08644430596871),
(3.30362630482521 , 1.08644555030213),
(3.30364633346451 , 1.08644866102000),
(3.30365300940335 , 1.08645052692055),
(3.30366102096957 , 1.08645177113937),
(3.30367036769496 , 1.08645363721023),
(3.30367837934959 , 1.08645488137174),
(3.30368906174976 , 1.08645612569695),
(3.30370107936906 , 1.08645799183673),
(3.30370642025712 , 1.08645985750225),
(3.30373179124734 , 1.08646358962156),
(3.30374514456618 , 1.08646545561358),
(3.30410706158729 , 1.08652886672786),
(3.30427803417922 , 1.08655868846497),
(3.30429673329093 , 1.08655930694968),
(3.30432478121775 , 1.08655930174652),
(3.30433278932944 , 1.08655308246640),
(3.30446348355532 , 1.08638330933224)
}'::spoly;
ERROR:  spherepoly_from_array: a line segment overlaps or polygon too large

Same for pgsphere-1.4.1.

The postgresql servers are running in fedora 38 lxd containers using postgresql15-server-15.5 from yum.postgresql.org and I built the pgsphere rpms from source (git clone, checkout tags, make source tarball, use rpmbuild). A wide range of testing of these different versions was good, but I ran into this one that I can't explain.

@vitcpp vitcpp self-assigned this Dec 4, 2023
@vitcpp vitcpp linked a pull request Dec 5, 2023 that will close this issue
@vitcpp
Copy link
Contributor

vitcpp commented Dec 5, 2023

@pdowler There is a severe bug in polygon validation function that was introduced recently some months ago, unfortunately. I've prepared a PR. If you don't mind I will use your polygon data in tests. Thank you very much for reporting!

@pdowler
Copy link
Contributor Author

pdowler commented Dec 5, 2023

thnx @vitcpp - yes, please retain that example for tests

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 a pull request may close this issue.

2 participants