Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4839 closed defect (wontfix)

ST_COVERS(geog,geom) converts to geog

Reported by: mschott Owned by: pramsey
Priority: medium Milestone: PostGIS 3.1.2
Component: postgis Version: 3.1.x
Keywords: Cc:

Description

ST_COVERS is not defined for (geog,geom) and should return an error. Yet it accepts these input and converts them both to geog. This may result in unexpected result for users.

Example query:

WITH dat AS (
    SELECT
        st_geomfromtext(
            'MULTIPOLYGON (((9.054873842478674 47.09228588254386, 9.054850052151716 47.09233645841942, 9.05480435533265 47.09258532420868, 9.054826866739429 47.09283566753151, 9.054916810034387 47.09307884446461, 9.055071080477116 47.09330645841384, 9.055183777676339 47.09343886008052, 9.055441954993599 47.09367734103295, 9.055476577156998 47.093697828566135, 9.055469591484222 47.09370732063176, 9.055367613475111 47.09395290905776, 9.055367104547708 47.09395689752222, 9.055362772866197 47.0939652606788, 9.055302761686672 47.09406612963827, 9.055202853468117 47.09428637537473, 9.055112243705258 47.094569873865694, 9.055090022455984 47.094651322330364, 9.05507191960377 47.09473122202577, 9.055063024464316 47.09477527210752, 9.055045620913221 47.09487337181371, 9.05503538813914 47.09494865881436, 9.05502328343589 47.095076558609904, 9.055019295464815 47.09517894501419, 9.055020692357344 47.09526294503941, 9.055023222397173 47.095317588143566, 9.055032452970845 47.095439025661626, 9.054917351859888 47.09555179810197, 9.054764044975759 47.095788230866496, 9.054679569002614 47.09604028886995, 9.054667024961208 47.09629872227369, 9.054726874224565 47.09655404714619, 9.05478046953243 47.09669464803487, 9.054924766319877 47.096957397078675, 9.05503091567514 47.0970712204215, 9.054989048646467 47.0971971322641, 9.054958531463232 47.097311528818054, 9.054938427884498 47.097411028479144, 9.054927548965145 47.097476715346126, 9.054917146024206 47.097557115170254, 9.054922819153989 47.09767145704576, 9.054842419108802 47.09786184868064, 9.054808588053143 47.098117939826736, 9.054846486468023 47.09837376521337, 9.05487958250509 47.09848746577, 9.05496856388852 47.09870017400209, 9.055107230149169 47.09890010062415, 9.055112073466947 47.0989058189686, 9.055103785261654 47.099088019226194, 9.055148951025437 47.09931214249486, 9.055176248176364 47.09939524295143, 9.05530692617613 47.09966050067191, 9.055345706271014 47.099705466784684, 9.055289490048452 47.09993361486957, 9.055303288949176 47.100204864156495, 9.055396279747761 47.10046874471504, 9.055564703679597 47.10071458706999, 9.055594940318104 47.10074916631876, 9.055632231550062 47.1008161361753, 9.05579501514289 47.101042287239565, 9.056016524062498 47.10124383622238, 9.056289038361278 47.10141375825726, 9.056603060054076 47.10154613075526, 9.056947644162062 47.10163633986867, 9.057310780235838 47.101681241336884, 9.057679811052433 47.10167927010274, 9.05789873398177 47.101649778087605, 9.057933710252145 47.101657582321906, 9.058311529152602 47.10168902246877, 9.058458481977206 47.10187378973814, 9.05863067063333 47.10205427187838, 9.0588427137112 47.10221375281423, 9.058898413834536 47.10224945346589, 9.059197808978958 47.10240743482673, 9.059535803544133 47.102523570837455, 9.059900013734625 47.10259360631775, 9.06027709502194 47.1026149751808, 9.06049030040907 47.10261307513079, 9.060527056785848 47.10261152550609, 9.060649715565383 47.102721951062634, 9.060649711474781 47.102724035263144, 9.06063629508894 47.10283139238911, 9.060681169700871 47.10309834652508, 9.060802600189307 47.10335394139171, 9.060995775191882 47.10358804750876, 9.061253039765544 47.10379138689206, 9.061564198658349 47.103955900793586, 9.06174899252774 47.10401833429805, 9.061803462540247 47.1041608754504, 9.061969550945818 47.10439620103096, 9.062198918351664 47.10460527520832, 9.062482974342217 47.1047802669821, 9.062811079788672 47.104914621860054, 9.063170945342705 47.10500330740298, 9.063549091795853 47.10504300175681, 9.063931355051137 47.10503221810319, 9.064293208320242 47.10499785079287, 9.064365466951694 47.10501286311288, 9.06474861482983 47.10503918446855, 9.065131967054304 47.105014288788105, 9.065500976770412 47.10493912077466, 9.06584164148942 47.1048165327798, 9.065956342857126 47.104764931700196, 9.06624427170231 47.10460722046453, 9.066484238400983 47.10441570987645, 9.066607732041055 47.10426868335, 9.066752537751126 47.104200315697106, 9.066934538850274 47.104097213709736, 9.067310200739373 47.10381417604131, 9.067435598624177 47.10368747426605, 9.067629316595657 47.103439476189585, 9.067634122131816 47.103431394338585, 9.067925713152768 47.10334009421205, 9.068223306508203 47.10319672173826, 9.068357378458217 47.10311855748476, 9.068678511117911 47.10300115028899, 9.068896438066856 47.10290856925403, 9.06901503925115 47.10285056807277, 9.069423285888893 47.102582854313994, 9.06946288548972 47.10254815378017, 9.069505518043355 47.10250900817957, 9.069701676459436 47.102362628558296, 9.069901680975002 47.10213779271274, 9.070034018159571 47.101890737637355, 9.070093662346917 47.101630847344005, 9.070078349138763 47.101367993233225, 9.06998866125607 47.10111215913667, 9.06996340989543 47.10107457861065, 9.070189677071006 47.10093901346317, 9.070418427195191 47.10073861177364, 9.07058812275588 47.100512487996205, 9.0706720505512 47.100316897448174, 9.070737898949304 47.10030054362723, 9.071076412493017 47.1001588048174, 9.07136660763572 47.09997372574144, 9.07159677396188 47.099752775355554, 9.071757623889972 47.09950487012045, 9.07184266739448 47.099240014131745, 9.071848473771778 47.098968895374064, 9.071774809907266 47.098702454398364, 9.071760708851677 47.09866985463011, 9.071732131789705 47.098609111093204, 9.07156233549809 47.09827548043113, 9.071091139153745 47.097305328446936, 9.07109100957291 47.09728250866881, 9.071019138275714 47.097031871643246, 9.070879419948776 47.09679496588671, 9.070697255128907 47.0965546200005, 9.069484527694721 47.09484305042201, 9.06819748648783 47.09301001496229, 9.067994911955704 47.09278231072813, 9.067730793241948 47.09258621696334, 9.067415421385942 47.09242937375342, 9.067061083978803 47.09231789186877, 9.066681586451576 47.09225611472485, 9.066291714283206 47.092246449193006, 9.065906657064886 47.09228927184745, 9.065673103852761 47.09234915177321, 9.06549733727821 47.09236849267439, 9.0653411407196 47.092400391907695, 9.065321947937814 47.09240526553365, 9.064992547111212 47.09229003770312, 9.064708827306731 47.09220913830038, 9.064649110815521 47.09219572928069, 9.064599509019772 47.09215847379699, 9.064295718495176 47.09200373084204, 9.063954267380511 47.091891431956014, 9.063587709788406 47.09182570596412, 9.063209522710663 47.091808969362575, 9.06252693993104 47.091823568989135, 9.062147180067027 47.09185703443111, 9.061499495174832 47.091958431950204, 9.061147334690117 47.09203794793086, 9.06082312790513 47.0921609990489, 9.060538292544035 47.092323251847326, 9.06036715000321 47.092465541288234, 9.06024133946614 47.09231930714279, 9.059937607245175 47.09204934062363, 9.059871724647985 47.09189088378893, 9.059851100629992 47.09186370732652, 9.059778722597578 47.091602209605675, 9.059628070838526 47.09135078297633, 9.05949336679905 47.09117798501057, 9.059289792116129 47.09097278077564, 9.059226589631885 47.090828688360375, 9.05912038462904 47.09065249004126, 9.058942282882702 47.090422762307654, 9.058703009009525 47.09022061032649, 9.058411437219739 47.09005353099445, 9.058078380902117 47.08992772046064, 9.057716191612961 47.08984784438045, 9.057338301074099 47.089816864923876, 9.056958723153762 47.089835930947494, 9.056591534282088 47.08990433539896, 9.056279040596754 47.08998533350093, 9.055945039192682 47.09009750773064, 9.055647753372801 47.09025046130705, 9.05539772679773 47.090438769696746, 9.055203827336852 47.09065575443691, 9.055072932535175 47.09089371995605, 9.055009685621906 47.09114422647362, 9.05501505314659 47.09134952455161, 9.05489101371756 47.09155559020575, 9.054816474272592 47.09180881241577, 9.054813923198472 47.0920670951496, 9.054873842478674 47.09228588254386)))',
            4326
        )::geography AS poly,
        st_geomfromtext(
            'MULTIPOLYGON (((5.7 47, 15.23 47, 15.23 55.07, 5.7 55.07, 5.7 47)))',
            4326
        ) AS bbox
)
SELECT
    st_covers(
        bbox,
        poly
    ),
        st_covers(
        bbox,
        poly::geometry
    ),
    bbox,
    poly,
    st_segmentize(bbox::geography,500)
FROM
    dat ;

Change History (2)

comment:1 by pramsey, 4 years ago

Resolution: wontfix
Status: newclosed

Yeah, I'm not sure I want to go and strip out implicit casting for geography/geometry. It has utility for other people.

comment:2 by mschott, 4 years ago

just suggesting: update the docu and make this an official behaviour?

Note: See TracTickets for help on using tickets.