Opened 13 years ago
Closed 12 years ago
Last modified 11 years ago
#457 closed defect (fixed)
ST_CollectionExtract returns non-requested type
|Reported by:||strk||Owned by:||pramsey|
strk=# select st_astext(ST_CollectionExtract('POINT(0 0)', 2)); st_astext ------------ POINT(0 0) strk=# select st_astext(ST_CollectionExtract('POINT(0 0)', 3)); st_astext ------------ POINT(0 0)
Change History (8)
by , 13 years ago
comment:1 by , 13 years ago
|Milestone:||→ PostGIS 1.5.1|
comment:2 by , 13 years ago
|Milestone:||PostGIS 1.5.1 → PostGIS 1.5.2|
comment:3 by , 13 years ago
It looks like this behavior is intended from the comment in the end of lwgeom_functions_basic.c:
/* Mirror non-collections right back */
But I agree that this is no good.
As the documentation is written now, it should definitly give an error message if the inputed geometry is not a collection, but it would also make sense as in the testcase.patch, the inputed geometry is mirrored if and only if it is of the type that is asked for. But then that should be reflected in the documentation to.
I can do the changes if someone decides which way to go
comment:4 by , 13 years ago
I add a patch that should give the results expected in testcase.patch So it should return the asked for type even if it is not in a collection.
But I have done nothing about the documentation.
If we go this way the function name is a little misleading. It maybe should have been something like ST_TypeExtract instead. But that is nothing for a minor release and I guess that is no big deal.
Or should we give an error message instead if function is feed with else than collection.
Or maybe, always return an empty collection when inputed geometry is not collection with a notice?
But it might be quite useful to just get everything of the asked for type even if it is no collection.
by , 13 years ago
only mirrors back non collection cases if type is the requested
comment:5 by , 12 years ago
|Status:||new → closed|
comment:6 by , 11 years ago
regression testcase (tickets)