[PostGIS] #5928: ST_Collect creates invalid result with only valid input

PostGIS trac at osgeo.org
Wed Mar 11 04:30:36 PDT 2026


#5928: ST_Collect creates invalid result with only valid input
--------------------------------+---------------------------
  Reporter:  Lars Aksel Opsahl  |      Owner:  pramsey
      Type:  defect             |     Status:  closed
  Priority:  medium             |  Milestone:  PostGIS 3.6.0
 Component:  postgis            |    Version:  3.5.x
Resolution:  worksforme         |   Keywords:
--------------------------------+---------------------------
Comment (by Lars Aksel Opsahl):

 Here we another case that reports invalid


 {{{
 POSTGIS="3.7.0dev 3.6.0rc2-305-g3b3488ddf" [EXTENSION] PGSQL="160"
 GEOS="3.12.1-CAPI-1.18.1" PROJ="8.2.1 NETWORK_ENABLED=OFF
 URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj
 DATABASE_PATH=/usr/share/proj/proj.db" (compiled against PROJ 8.2.1)
 LIBXML="2.9.13" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0
 (Internal)" TOPOLOGY
 PostgreSQL 16.13 (Ubuntu 16.13-1.pgdg22.04+1) on x86_64-pc-linux-gnu,
 compiled by gcc

 POSTGIS="3.7.0dev 3.6.0rc2-305-g3b3488ddf" [EXTENSION] PGSQL="160"
 GEOS="3.14.0beta3-CAPI-1.20.2" PROJ="9.3.0 NETWORK_ENABLED=OFF
 URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj
 DATABASE_PATH=/usr/local/share/proj/proj.db" (compiled against PROJ 9.3.0)
 LIBXML="2.9.13" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0
 PostgreSQL 16.4 (Ubuntu 16.4-1.pgdg22.04+1) on x86_64-pc-linux-gnu,
 compiled by gcc

 POSTGIS="3.4.2 c19ce56" [EXTENSION] PGSQL="160" GEOS="3.12.1-CAPI-1.18.1"
 (compiled against GEOS 3.10.2) SFCGAL="SFCGAL 1.4.1, CGAL 5.3.1, BOOST
 1.74.0" PROJ="8.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org
 USER_WRITABLE_DIRECTORY=/tmp/proj DATABASE_PATH=/usr/share/proj/proj.db"
 GDAL="GDAL 3.4.1, released 2021/12/27" LIBXML="2.9.13" LIBJSON="0.15"
 LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER
 PostgreSQL 16.3 (Ubuntu 16.3-1.pgdg22.04+1) on x86_64-pc-linux-gnu,
 compiled by gcc


 }}}
 with this SQL


 {{{
 SELECT st_isvalid('MULTIPOLYGON(((12.73351507 66.6119868,12.72915463
 66.61146327,12.72920119 66.60972247,12.72945039 66.60975288,12.73086236
 66.60987212,12.73225836 66.60991913,12.73311671 66.61016498,12.73362813
 66.61025306,12.73434255 66.61034415,12.73575726 66.61043645,12.7386931
 66.61068521,12.73988777 66.61071138,12.74061663 66.61089232,12.74076635
 66.61098432,12.74086396 66.61107749,12.73850885 66.61179694,12.73501412
 66.61224321,12.73351507 66.6119868)),((12.72464326 66.6047916,12.72509264
 66.60481597,12.72582554 66.60495225,12.72602674 66.60508232,12.72603872
 66.60509007,12.7267101 66.60515356,12.72723185 66.60537653,12.72751001
 66.60554212,12.72772402 66.60567088,12.72772215 66.60594021,12.72750993
 66.60603578,12.72660539 66.60604961,12.7256939 66.6058928,12.72486593
 66.60583665,12.72434737 66.60580148,12.72412926 66.60571753,12.72406373
 66.60544731,12.72423639 66.60528825,12.72485844 66.60515366,12.72446238
 66.60504021,12.72440707 66.60490477,12.72464326 66.6047916)),((12.72785797
 66.60865523,12.72763914 66.6085689,12.72730494 66.60851909,12.72522934
 66.6084981,12.72489657 66.60843035,12.72482116 66.6082677,12.72545361
 66.60777422,12.72573269 66.60768851,12.72640825 66.60770736,12.72721032
 66.60782659,12.72845445 66.60805104,12.72886242 66.60817634,12.73007995
 66.60855026,12.73013634 66.60867683,12.73098171 66.60881471,12.73148102
 66.60903725,12.73154189 66.60911003,12.73164482 66.60921922,12.73188105
 66.60959953,12.73180518 66.60968828,12.73114001 66.60955292,12.73062205
 66.60953654,12.73041331 66.60959627,12.72956277 66.60951225,12.72923266
 66.60941763,12.72906475 66.60928066,12.72921382 66.60913014,12.72950374
 66.60917032,12.72956074 66.60928774,12.7297871 66.60928213,12.72984042
 66.60919314,12.72968418 66.60917293,12.72921628 66.60910324,12.72877257
 66.60901604,12.72785797 66.60865523)),((12.73199805
 66.60681972,12.73168389 66.6072327,12.73166897 66.60722696,12.73076767
 66.60720496,12.73020794 66.60715199,12.72968801 66.60691102,12.72935792
 66.60681648,12.72930011 66.60670794,12.73042939 66.60670632,12.73065902
 66.60666476,12.73065123 66.60650308,12.73054584 66.60642087,12.72987666
 66.60633032,12.72970714 66.60621119,12.72891063 66.60602913,12.72845286
 66.60585196,12.72846291 66.60549317,12.72879506 66.60531837,12.72966186
 66.6052232,12.73056228 66.60525417,12.7312749 66.60536321,12.73173701
 66.60549555,12.73196047 66.60576814,12.73234428 66.60601602,12.73273465
 66.6061922,12.73263215 66.60632527,12.73184734 66.6065114,12.73188898
 66.60679922,12.73199805 66.60681972)),((12.73501412
 66.61224321,12.73850885 66.61179694,12.74086396 66.61107749,12.7411196
 66.6113215,12.74189603 66.61147628,12.74201596 66.61136007,12.74542231
 66.61212045,12.74544837 66.61215563,12.74595556 66.61228857,12.74651463
 66.61235045,12.74668694 66.61244268,12.74657412 66.61269238,12.74577594
 66.61302199,12.74594826 66.61311422,12.74674897 66.61325138,12.74680661
 66.61361132,12.74646416 66.61365119,12.74651717 66.61381352,12.74729591
 66.61419269,12.74719752 66.61428112,12.74696949 66.61430469,12.74638863
 66.61423353,12.74465746 66.61414584,12.74347271 66.61425448,12.74323027
 66.61418816,12.74362602 66.61405922,12.74329987 66.61391989,12.7430759
 66.61389872,12.74278479 66.61411893,12.74267985 66.61427907,12.74149695
 66.61436968,12.73962089 66.61462991,12.73697154 66.61469946,12.73691847
 66.61478845,12.73628819 66.61476141,12.73532734 66.61464883,12.73471494
 66.61467589,12.73414006 66.61478437,12.73307809 66.614787,12.73229014
 66.61475758,12.73069452 66.61491404,12.72969859 66.61493555,12.72935116
 66.61502926,12.72901275 66.61502436,12.7287929 66.61495835,12.72827566
 66.61493292,12.7277744 66.61497961,12.72755314 66.61493144,12.72743563
 66.61473227,12.72720555 66.61453148,12.72715694 66.613337,12.72676485
 66.61317874,12.72676635 66.61291847,12.72643597 66.61282393,12.72637662
 66.61223964,12.72576027 66.61181783,12.72537679 66.61181228,12.72509342
 66.61170046,12.72492742 66.61129415,12.72480995 66.61035897,12.72464185
 66.61022181,12.72458651 66.61008646,12.72476333 66.60988249,12.72477142
 66.6095506,12.72521703 66.60936847,12.72579405 66.60923331,12.72658184
 66.60926258,12.72747089 66.60941907,12.7281996 66.60960024,12.72920119
 66.60972247,12.72915463 66.61146327,12.73351507 66.6119868,12.73501412
 66.61224321)),((13.22577765 66.67543727,13.22606296
 66.67535461,13.22609082 66.67537664,13.22613021 66.67540185,13.22616388
 66.67542485,13.22620612 66.67545458,13.2262548 66.67546401,13.22630894
 66.67546991,13.22636625 66.67547594,13.22643214 66.6754853,13.22649212
 66.67549818,13.22654908 66.6755121,13.22659456 66.67552823,13.22661366
 66.67555232,13.22663361 66.67556143,13.22668009 66.67554472,13.22671799
 66.67552774,13.22676428 66.67552,13.22677771 66.67554744,13.22675682
 66.67557349,13.22671833 66.6756051,13.22669153 66.67563459,13.22667872
 66.67567438,13.22667814 66.67569824,13.2266939 66.67574041,13.22671861
 66.6757747,13.22672951 66.67579636,13.22671135 66.67582236,13.22667899
 66.6758473,13.22664915 66.67588134,13.22663645 66.67591646,13.22663562
 66.67594382,13.22666567 66.67598562,13.22661911 66.67600035,13.22620044
 66.67583671,13.2262 66.67583652,13.22637713 66.67578494,13.22577765
 66.67543727)),((13.23020803 66.67515154,13.23022813
 66.67512377,13.23031378 66.67500583,13.23020168 66.67479745,13.22996078
 66.67483881,13.22985477 66.6749628,13.22985056 66.67496796,13.22977083
 66.67493359,13.22966834 66.67488523,13.2296721 66.6748833,13.22984137
 66.67479906,13.22980719 66.67470409,13.22968287 66.67463171,13.22958072
 66.67463872,13.22950541 66.67464389,13.2295044 66.67464208,13.22949659
 66.67462154,13.2294889 66.67459309,13.22945828 66.67456224,13.22941906
 66.67453128,13.22940857 66.67450389,13.22939536 66.67446398,13.22938759
 66.6744333,13.2293654 66.6744081,13.22933493 66.67437841,13.22929591
 66.67433831,13.2292637 66.67430761,13.22929812 66.67429481,13.22930103
 66.67425733,13.2296393 66.67413039,13.23003912 66.67420937,13.23038481
 66.67429501,13.23084593 66.67478603,13.23203652 66.67493546,13.23391416
 66.67437307,13.23396182 66.67435871,13.23396914 66.67435771,13.23400744
 66.67433176,13.23402528 66.67431024,13.2340714 66.67430475,13.23412305
 66.67431071,13.23417109 66.67432911,13.23422775 66.67435675,13.2342754
 66.67439336,13.2343034 66.6744197,13.23430819 66.67444138,13.23427824
 66.67448672,13.23425149 66.6745093,13.23422782 66.6745365,13.23420435
 66.67455122,13.23415713 66.67458165,13.23412504 66.67459978,13.23406398
 66.67462099,13.23406073 66.674638,13.23408277 66.67466544,13.23411036
 66.67469752,13.23413533 66.67472831,13.23416899 66.67475471,13.23420015
 66.67476852,13.23424852 66.67478243,13.23430537 66.67480425,13.23433929
 66.67482383,13.2343326 66.67484772,13.23430045 66.67486683,13.23425398
 66.67488022,13.23419014 66.67489924,13.23412924 66.67491498,13.23403421
 66.67492693,13.23398297 66.67491531,13.23391144 66.6749024,13.23386256
 66.67490212,13.23381669 66.6749008,13.23375675 66.67489366,13.23370171
 66.67490363,13.23363856 66.67490328,13.23359847 66.67489404,13.23354166
 66.6748812,13.23348153 66.67486724,13.23340729 66.67485429,13.23330105
 66.6748583,13.23327168 66.67487637,13.23326237 66.67489574,13.23324966
 66.67493427,13.2332206 66.67495127,13.23318545 66.67496469,13.23311346
 66.67496774,13.23305916 66.67496408,13.23303274 66.67498209,13.23299774
 66.67499668,13.23299128 66.67502057,13.23297882 66.67505238,13.23296361
 66.67507509,13.23295984 66.67510574,13.23298457 66.67513662,13.2330177
 66.67517997,13.2329681 66.67519916,13.23293861 66.67522853,13.23293797
 66.67525015,13.23293969 66.6752831,13.23295836 66.67533222,13.23296052
 66.6753527,13.23294252 66.67537646,13.23289215 66.67541601,13.23283974
 66.67543974,13.23281363 66.67545659,13.23276934 66.67548714,13.23271425
 66.67550393,13.23265925 66.67551955,13.2325588 66.67551223,13.2325212
 66.67551881,13.2325036 66.67553692,13.23247674 66.67556749,13.23244459
 66.67558328,13.23238994 66.6755876,13.23233238 66.67558839,13.23228651
 66.67558707,13.23226027 66.67559942,13.23225628 66.67562675,13.2322095
 66.67565718,13.23215781 66.67565813,13.23210622 66.67565782,13.23203944
 66.6756734,13.23199048 66.67567429,13.23195847 66.67569125,13.23190907
 66.6757046,13.23184598 66.67570658,13.23178946 66.6756801,13.23176144
 66.67565718,13.23173319 66.67563433,13.23167085 66.67561012,13.23160527
 66.67559951,13.23157987 66.6755811,13.23155779 66.67556057,13.23152397
 66.6755365,13.23150884 66.67555805,13.2314397 66.67556562,13.23138848
 66.67555059,13.23132882 66.67553323,13.23127208 66.67550343,13.23121845
 66.67547465,13.23116775 66.6754459,13.23108538 66.67541366,13.23103118
 66.67540542,13.23095408 66.67539136,13.23088273 66.67537279,13.23078887
 66.67534616,13.23068658 66.67531378,13.23058979 66.67528703,13.2304646
 66.67524883,13.23041062 66.67522812,13.23032789 66.67520727,13.23029127
 66.67518433,13.23024897 66.67516474,13.23020803
 66.67515154)),((13.22309161 66.67505241,13.22511523 66.67615246,13.2262
 66.67583652,13.22620044 66.67583671,13.22661911 66.67600035,13.22666567
 66.67598562,13.22668504 66.67601231,13.22672084 66.67606252,13.22674818
 66.676098,13.2268047 66.67613696,13.22686643 66.67617597,13.22691139
 66.67620573,13.22695667 66.67623101,13.22703334 66.67625754,13.22705563
 66.67627816,13.22706926 66.67629653,13.22709422 66.67632732,13.22711943
 66.67635139,13.22717673 66.67636074,13.22723371 66.67637125,13.22726159
 66.67638969,13.22728099 66.67641593,13.22732628 66.67644121,13.22738081
 66.67644488,13.22743554 66.67643939,13.22748192 66.67642726,13.22754302
 66.67640246,13.22760922 66.67639486,13.22766886 66.67641564,13.22775115
 66.67644896,13.22782719 66.67649378,13.22787212 66.67652704,13.22790589
 66.67654878,13.22794841 66.67656838,13.22800521 66.67658454,13.22805357
 66.67659846,13.22808767 66.67661239,13.22811291 66.67663295,13.22812901
 66.67667056,13.22814558 66.67668887,13.22812723 66.67672061,13.2280409
 66.67672475,13.22798645 66.67671992,13.22793164 66.67672639,13.22791952
 66.67675031,13.22791285 66.67677069,13.2279178 66.67680269,13.22791996
 66.67682309,13.22795086 66.67684372,13.22801936 66.67685777,13.22806791
 66.67686594,13.22814768 66.67689026,13.22817859 66.67690748,13.22822978
 66.67692933,13.2282951 66.67694675,13.22837785 66.67696429,13.22842323
 66.67698499,13.22844865 66.6769999,13.22848519 66.677024,13.22852461
 66.67704581,13.22858129 66.67707004,13.22865818 66.67709657,13.22872939
 66.67711398,13.22878635 66.67712799,13.2288003 66.67714511,13.22881407
 66.67716456,13.22884161 66.67719421,13.22889827 66.67722186,13.22894376
 66.67723798,13.22897164 66.67725975,13.22899932 66.67729057,13.22902381
 66.67733742,13.22904314 66.67736474,13.22905953 66.67738879,13.22909276
 66.67742425,13.22911757 66.67745728,13.22916852 66.67747922,13.22921461
 66.67748063,13.22922104 66.677451,13.22923077 66.67742266,13.22929965
 66.67742191,13.22933646 66.67743911,13.22936188 66.67745411,13.22938984
 66.67747471,13.22944387 66.67750116,13.22949217 66.67751274,13.2295577
 66.67753358,13.22959966 66.67756115,13.22962212 66.67757944,13.22966157
 66.67761039,13.22970636 66.67764249,13.22975737 66.67765751,13.22979746
 66.67766675,13.22982862 66.67768056,13.22985386 66.67770122,13.22987887
 66.67772519,13.22991289 66.6777402,13.23001004 66.67775888,13.2300627
 66.67781718,13.23009319 66.67784363,13.22706787 66.67874052,13.22702484
 66.67875322,13.22700455 66.6787425,13.22695629 66.67872401,13.2268798
 66.67869174,13.22679724 66.67866523,13.22673736 66.67864777,13.22667761
 66.67863158,13.22664639 66.67861543,13.22660723 66.67858681,13.22657671
 66.67855138,13.22655486 66.67851829,13.226527 66.67849312,13.22648464
 66.67847129,13.22643363 66.6784437,13.22637726 66.67841839,13.22632649
 66.67838739,13.22628712 66.67835868,13.22623945 66.67832557,13.2262177
 66.6782879,13.22620153 66.67825138,13.22617146 66.67820339,13.22613514
 66.67816681,13.22609031 66.67814154,13.22602772 66.67812074,13.22595105
 66.67809421,13.22588587 66.67806538,13.22583231 66.67803553,13.2257932
 66.678,13.22577412 66.67796927,13.22576064 66.67793619,13.22574417
 66.6779133,13.22570484 66.67789033,13.22564793 66.67786618,13.22557404
 66.67784192,13.22548588 66.67782101,13.22540619 66.67779552,13.22534403
 66.67776565,13.22529007 66.67774144,13.2252393 66.67771054,13.22519991
 66.67768524,13.22516344 66.67766338,13.22510677 66.67763582,13.22503307
 66.67760582,13.22493925 66.67757237,13.22483434 66.67753547,13.22473772
 66.67750306,13.22462949 66.67746837,13.22457662 66.67744785,13.22455106
 66.67740655,13.22312366 66.67510419,13.22309161
 66.67505241)),((13.22489005 66.67378623,13.22435241
 66.67356174,13.22297643 66.67341044,13.22247757 66.67401376,13.22256566
 66.67419289,13.22244167 66.67399353,13.22121075 66.67201759,13.22096229
 66.67172672,13.22468265 66.67217543,13.22724258 66.67246803,13.22695369
 66.67338405,13.22613165 66.67339067,13.2257825 66.67324638,13.22546299
 66.67340206,13.22567275 66.67356757,13.22628639 66.67362259,13.22655299
 66.67376576,13.22723131 66.67356297,13.2272889 66.67359961,13.22728711
 66.67359941,13.22717202 66.67363849,13.22709713 66.6736599,13.22701887
 66.67368101,13.22694121 66.67370319,13.22687156 66.67372108,13.2267888
 66.673745,13.22668548 66.67377462,13.22660735 66.67380021,13.22652309
 66.67382923,13.22643595 66.67385723,13.22637838 66.67387722,13.22627906
 66.67390787,13.22617426 66.67393909,13.22609788 66.67396865,13.22624118
 66.67387415,13.2257688 66.67376545,13.22549691 66.67393262,13.22537784
 66.67414377,13.22578962 66.67422308,13.22595816 66.67406067,13.22594648
 66.67408145,13.22592065 66.67411328,13.2258961 66.67414944,13.22587371
 66.67418382,13.22585783 66.67422214,13.22584436 66.67424891,13.2258066
 66.67428294,13.22576626 66.67431829,13.22572935 66.67434668,13.22565375
 66.67437491,13.22553395 66.67440703,13.22562304 66.674459,13.22575278
 66.67442403,13.22585745 66.6743851,13.22590873 66.67434566,13.22595147
 66.67430854,13.22596226 66.67429876,13.2260058 66.67424553,13.22609747
 66.67427097,13.22615785 66.6742959,13.22626392 66.6743397,13.2262419
 66.6743651,13.22625277 66.67437843,13.22620325 66.67439645,13.22613665
 66.6744097,13.22609353 66.67441747,13.22605279 66.67442984,13.22603195
 66.67444899,13.22601705 66.67447054,13.22600445 66.67449776,13.22598616
 66.67453184,13.22596486 66.67456363,13.22594067 66.67460096,13.22593131
 66.67463047,13.22592443 66.67466009,13.22590967 66.67468281,13.22589439
 66.67470651,13.22589002 66.67474532,13.2258981 66.67477143,13.22589989
 66.67480331,13.2259047 66.67483405,13.22591215 66.67486599,13.22592303
 66.67489106,13.22592731 66.67493544,13.22590941 66.67495462,13.22590582
 66.6749763,13.22593941 66.67500037,13.22600737 66.67503138,13.22608687
 66.67506251,13.22611786 66.67507866,13.22616529 66.67512442,13.2261787
 66.67515517,13.22616913 66.67518136,13.22613713 66.67519823,13.22606812
 66.6751944,13.22599355 66.67518611,13.22595035 66.67519495,13.22593261
 66.67521189,13.22593451 66.67523588,13.22594514 66.67526435,13.22597022
 66.67528725,13.22600682 66.6753136,13.22606296 66.67535461,13.22577765
 66.67543727,13.22523208 66.6751209,13.22475963 66.67412693,13.22489005
 66.67378623)))');
 NOTICE:  00000: Self-intersection at or near point 13.226665669999999
 66.675985620000006
 LOCATION:  pg_notice, lwgeom_pg.c:354
  st_isvalid
 ------------
  f
 (1 row)

 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5928#comment:6>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list