Opened 4 years ago

Closed 4 years ago

#4697 closed defect (fixed)

Error message "BOOM! ..." using ST_Distance with geographic multipolygon

Reported by: johannesrummel Owned by: pramsey
Priority: medium Milestone: PostGIS 2.5.5
Component: postgis Version: 2.4.x
Keywords: st_distance geography multipolygon boom error Cc:

Description

Using ST_Distance with a geographic point and multipolygon sometimes results in error message:

ERROR:  BOOM! Could not generate outside point!
SQL state: XX000

Example code that causes the error:

DROP TABLE IF EXISTS points_test;
CREATE TABLE points_test ( point geography(POINT,4326) );
INSERT INTO points_test (point)
VALUES (ST_SetSRID( ST_Point( 0, 0), 4326)::geography),
	(ST_SetSRID( ST_Point( 100, 0), 4326)::geography);
	
DROP TABLE IF EXISTS multipolygon_test;
CREATE TABLE multipolygon_test ( multipolygon geography(MULTIPOLYGON,4326) );
INSERT INTO multipolygon_test VALUES (ST_GeogFromText('srid=4326;MULTIPOLYGON(((146.230028 -38.697083,146.276222 -39,145.371639 -38.539611,145.488306 -38.235444,144.658361 -38.311278,145.116278 -38.148333,144.928306 -37.842917,143.556639 -38.85875,140.581667 -38.032917,139.740361 -37.183306,139.612111 -36.156722,139.722472 -36.288806,139.517556 -35.96125,138.890806 -35.53375,138.097861 -35.626694,138.567861 -34.826667,138.094194 -34.135417,137.762556 -35.117944,136.851694 -35.285417,137.015833 -34.895444,137.452944 -34.908333,137.450444 -34.140028,137.977917 -33.553361,137.754139 -32.458778,137.781 -33,135.933722 -34.534194,135.9575 -35.007917,135.112889 -34.59,135.51875 -34.614194,134.707917 -33.181667,134.059611 -32.914139,134.181667 -32.485417,131.152472 -31.464583,125.9575 -32.288778,124.234139 -33.019583,123.526667 -33.937972,119.903361 -33.934583,117.953306 -35.128778,116.624139 -35.057944,115.128306 -34.372944,115.000417 -33.528361,115.697917 -33.300861,115.882944 -31.961694,115.052111 -30.507528,114.867056 -29.114194,113.152861 -26.149194,113.837917 -26.591667,113.509111 -25.505417,113.722083 -26.200028,113.870806 -25.942083,114.231222 -26.315889,113.39625 -24.406694,113.990417 -21.872528,114.330028 -22.522139,114.645833 -21.837917,116.804167 -20.523778,117.377472 -20.777083,119.092472 -19.957917,121.113306 -19.539611,122.369556 -18.1175,122.172917 -17.263333,122.922528 -16.387944,123.566722 -17.627083,123.569528 -17.037556,123.930806 -17.267917,123.971278 -16.825833,123.504583 -16.6625,123.5575 -16.17375,124.400028 -16.565444,124.97625 -16.381722,124.391306 -16.339222,124.750389 -15.810889,124.495 -16.002972,124.360417 -15.670028,124.675028 -15.254583,125.249583 -15.581667,124.829556 -15.157472,125.506694 -15.172056,125.137889 -14.745833,125.614167 -14.230472,125.918361 -14.677083,126.009167 -13.920389,126.230028 -14.250417,126.535806 -13.932083,126.612528 -14.250417,126.874972 -13.747139,127.428333 -13.942944,128.227056 -14.714194,128.009972 -15.51375,128.128333 -15.18625,128.372139 -15.496694,128.199583 -15.069222,128.559139 -14.766278,129.092528 -14.904611,129.125861 -15.281278,129.29 -14.862083,129.605833 -15.20625,129.998778 -14.705861,129.365417 -14.339972,129.816639 -13.499583,130.317972 -13.373333,130.351222 -12.670028,130.732083 -12.728333,130.575833 -12.407111,130.964972 -12.671278,130.812139 -12.408333,131.287528 -12.045444,131.4625 -12.285444,132.762944 -12.154583,132.722972 -11.623333,131.767889 -11.325833,131.973333 -11.127111,133.508333 -11.879583,133.915833 -11.742083,134.150889 -12.174583,134.748389 -11.95125,135.215389 -12.300861,135.9125 -11.952917,135.652889 -12.206667,136.045 -12.064611,136.016694 -12.498778,136.564139 -11.879611,136.977972 -12.348333,136.462083 -12.7775,136.461667 -13.253778,135.909556 -13.285,136.072111 -13.667528,135.411222 -14.934972,136.676667 -15.926306,139.036639 -16.912917,139.598361 -17.538778,140.609167 -17.613806,141.667028 -15.040861,141.46125 -13.852528,141.976833 -12.594778,141.586222 -12.558361,142.079611 -11.985861,142.130389 -10.961694,142.534167 -10.688722,143.545417 -12.844167,143.772917 -14.399194,144.515056 -14.16625,145.347889 -14.949194,145.402139 -16.435,145.957889 -16.897528,146.260444 -18.863389,148.772944 -20.236694,149.630472 -22.585,149.8125 -22.382111,150.060417 -22.658361,150.041667 -22.125417,150.635861 -22.660444,150.668306 -22.347083,150.791667 -23.509611,151.769556 -24.020861,153.192944 -25.931694,153.024583 -27.294194,153.639583 -28.638361,153.065417 -31.058389,152.359556 -32.186667,152.542944 -32.444222,151.201222 -33.510833,150.602944 -34.865833,150.842944 -35.066694,150.152972 -35.700972,149.979611 -37.505056,147.657472 -37.850444,147.454139 -38.079611,147.972083 -37.893361,146.230028 -38.697083)),((150 -10.087917,150.005028 -10.087944,150.877083 -10.23,150.201667 -10.704611,149.743333 -10.34875,147.725 -10.107139,146.089972 -8.095417,144.861639 -7.781278,144.7525 -7.407111,144.536639 -7.695444,144.372889 -7.436639,144.505833 -7.81875,143.637472 -7.431278,143.928778 -7.993361,143.391306 -7.929167,143.694194 -8.232917,142.210833 -8.177083,143.402917 -8.758333,142.639167 -9.335444,142.219139 -9.077917,141.125833 -9.234028,140.036722 -8.007083,138.955056 -8.259639,139.139556 -7.580861,138.671222 -7.214194,139.243778 -7.140861,138.54375 -6.954194,138.921306 -6.830861,138.395389 -6.335833,138.367083 -5.669167,138.05375 -5.733361,138.116639 -5.377111,135.198278 -4.458778,134.617944 -4.115806,134.932472 -3.918806,133.969139 -3.867111,133.617917 -3.475028,133.8075 -2.910444,133.447917 -3.866722,132.895833 -4.087083,132.837028 -3.3025,131.947056 -2.774222,132.724139 -2.80625,133.219167 -2.407111,133.666694 -2.730444,133.939583 -2.090861,132.308306 -2.285444,131.963361 -1.477944,130.930444 -1.434972,131.222083 -0.828389,132.415639 -0.338583,133.983278 -0.722944,134.174556 -2.353333,134.458333 -2.865472,134.630444 -2.480028,135.107472 -3.374611,135.765806 -3.1205,136.391333 -2.217917,137.170806 -2.113806,137.113306 -1.795472,137.890861 -1.464639,144.523333 -3.81125,145.805417 -4.850861,145.759167 -5.479611,147.625417 -6.111694,147.856694 -6.652083,146.950444 -6.734194,147.17625 -7.4625,148.130389 -8.064194,148.603306 -9.084611,149.250861 -8.998778,149.237528 -9.502111,150.012556 -9.631278,149.710389 -9.820056,150 -10.087917)),((115 -4.014583,114.998361 -4.016278,114.594583 -4.1675,114.530833 -3.350472,113.635028 -3.464611,113.614167 -3.149611,113.022222 -2.93825,111.9025 -3.569611,111.701639 -2.802917,110.259167 -2.96625,109.955389 -1.108389,109.430833 -1.287083,109.640389 -0.986667,109.244611 -0.660833,109.59125 -0.740028,109.110417 -0.515056,109.282083 0.008333,108.910389 0.321611,108.907056 1.160833,109.64175 2.083944,109.892333 1.697917,111.170778 1.364583,111.433306 2.707056,113.035 3.167917,113.971667 4.601222,115.375889 4.906111,115.607111 5.229972,115.370417 5.410806,115.86375 5.580833,116.745861 7.034528,116.813333 6.549583,117.15075 7.007917,117.737889 6.424139,117.558056 5.902194,118.007472 6.064556,117.940806 5.669556,118.35 5.829583,119.262139 5.360028,118.123722 4.883333,118.550806 4.352083,117.359556 4.162444,117.768306 3.647917,117.013722 3.596667,118.094583 2.313333,117.734556 2.189167,117.843722 1.862472,118.999583 0.984167,118.364139 0.800389,117.888722 1.12,118.036222 0.786667,117.462056 0.090833,117.614583 -0.780833,116.8975 -1.271278,116.702083 -1.085,116.165444 -1.803361,116.60125 -2.195833,116.312917 -2.960833,116.099583 -2.862528,116.277917 -3.130028,115 -4.014583)),((44.999139 -25.487083,44.998306 -25.487083,44.027056 -25,43.230417 -22.325028,43.497889 -21.3125,44.483778 -19.9875,43.929583 -17.496667,44.437472 -16.190417,46.175 -15.70375,46.502472 -15.997944,46.472472 -15.510417,46.958278 -15.201278,46.891222 -15.608361,47.209556 -15.471694,47.047083 -15.178389,47.463306 -14.671278,47.486667 -15.088778,47.762111 -14.249167,48.042028 -14.265028,47.892917 -13.594167,48.264111 -13.817111,48.812056 -13.379167,48.720389 -12.442528,49.272528 -11.954583,49.19125 -12.305,49.930389 -13.044222,50.465417 -15.447528,50.161611 -15.996278,49.897528 -15.435417,49.621194 -15.539194,49.837083 -16.839194,49.44375 -17.211667,49.430389 -18.164194,47.101222 -24.993333,44.999139 -25.487083)),((-65.999139 61.954944,-65.998389 61.953722,-71.641083 63.13325,-72.120889 63.442139,-71.200028 63.594222,-72.639528 63.845111,-73.283639 64.660417,-73.576944 64.313833,-74.606889 64.902361,-74.460556 64.383778,-78.030139 64.427389,-77.376444 65.4715,-75.803 65.233889,-73.471611 65.44775,-74.457833 66.165167,-73.071611 66.720694,-72.051722 66.670194,-73.004694 66.778722,-72.152694 67.270389,-73.660667 68.664806,-74.230833 68.519306,-75.472472 69.027,-76.646556 68.694917,-75.588222 69.235694,-76.195667 69.672528,-77.188833 69.641972,-76.993306 69.98875,-77.627194 69.748611,-78.986083 70.708,-79.600833 70.374417,-78.794611 69.887972,-81.728417 70.14575,-80.932861 69.721167,-83.029444 70.314556,-81.761167 69.874278,-85.819278 70.009333,-86.381778 70.528222,-87.858139 70.239972,-88.792556 70.498111,-89.530833 71.091028,-85 71.204972,-84.772417 70.932972,-84.480806 71.637417,-86.03875 72.021083,-85.225806 72.266611,-84.148889 72.006556,-85.701639 72.904722,-83.951556 72.747139,-85.543 73.033083,-83.698417 73.007222,-85 73.348056,-81.548056 73.724028,-80.225694 72.736194,-80.962306 71.883944,-79.790417 72.504722,-77.730611 71.746444,-78.88125 72.234111,-77.003833 72.136056,-78.550222 72.438444,-77.575083 72.761917,-75.150194 72.490667,-76.401056 71.859222,-74.208667 72.061139,-75.365917 71.684361,-74.6165 71.659778,-75.047611 71.178778,-73.599194 71.779194,-73.855417 71.049389,-72.549889 71.660722,-71.154833 71.273083,-72.565833 70.615556,-70.604278 71.058972,-71.972528 70.419972,-71.165472 70.546444,-71.543028 70.0265,-69.884167 70.884111,-70.615278 70.457528,-69.447611 70.794861,-68.285611 70.525528,-70.177972 70.032333,-68.676389 70.207333,-70.023194 69.621167,-68.160528 70.318417,-67.259 69.972444,-67.205556 69.717917,-70.062222 69.542389,-67.230889 69.467528,-66.701139 69.170722,-69.040056 69.358,-68.083778 69.222972,-69.012083 68.977361,-68.199972 69.151722,-67.775667 68.78525,-69.408139 68.815139,-66.673889 68.446889,-67.882806 68.269194,-67.019028 68.331,-66.747889 67.932417,-66.314528 68.124556,-66.374222 67.768139,-65.940444 68.032667,-66.032889 67.596611,-65.803528 67.973056,-65.342833 67.588778,-64.721667 67.977917,-65.230167 67.642056,-64.53 67.810361,-63.950917 67.3425,-64.795 67.368722,-63.957472 67.266639,-64.720111 67.007889,-63.500056 67.235389,-63.813306 66.900389,-63.118306 67.332056,-63.809972 66.804583,-62.84175 66.967889,-62.733472 66.656278,-62.02675 67.052917,-61.292528 66.667444,-62.197528 66.614972,-61.543389 66.318694,-62.895944 66.334139,-61.949194 66,-62.949194 66.146694,-62.676722 65.574611,-63.529222 65.929972,-63.53675 64.876222,-65.501528 65.740694,-64.358389 66.355444,-65.874583 65.944111,-65.481 66.385694,-65.98525 66.10725,-66.737528 66.597361,-67.939778 66.633611,-67.132722 66.01825,-68.367472 66.072667,-68.235972 65.427556,-67.316111 65.665278,-66.730667 64.72075,-66.676694 65.041778,-66.314389 64.610139,-65.68675 64.848444,-65.040194 64.43075,-65.671444 64.303111,-64.612611 63.976667,-64.51675 63.242056,-65.315917 63.805194,-64.897528 62.631667,-67.915167 63.7695,-67.688528 63.368944,-68.983389 63.755861,-65.999139 61.954944)),((103.999139 -5.325444,103.998361 -5.324583,101.581278 -3.204222,100.324583 -0.854167,99.136222 0.253306,98.797056 1.730806,97.750861 2.276222,96.867056 3.694972,95.537111 4.661667,95.227528 5.582944,97.503306 5.255389,98.28875 4.430833,98.155833 4.084556,99.753306 3.179528,100.933278 1.809556,101.047472 2.302917,102.413333 0.805361,102.909972 0.717083,103.10625 0.455861,102.6825 0.225361,103.327472 0.549556,103.72875 0.280806,103.276222 -0.705861,104.367472 -1.017917,104.479556 -1.99,104.87875 -2.084222,104.712917 -2.6,104.847472 -2.284583,105.619139 -2.392111,106.087056 -3.225806,105.723333 -5.904639,105.284167 -5.446278,105.160833 -5.809611,104.529944 -5.522111,104.581694 -5.945444,103.999139 -5.325444)),((136 33.710417,135.997889 33.708306,135.753333 33.436222,135.057889 33.881694,135.336667 34.725389,134.185833 34.741222,132.556667 34.069583,132.400806 34.37625,132.139139 33.83125,130.905 33.912889,130.866278 34.291667,133.092472 35.607056,136.070833 35.662056,136.756667 37.36375,137.345389 37.515806,136.860389 37.081667,137.331694 36.762944,139.425028 38.148722,140.103722 39.679167,140.070028 39.998778,139.703694 39.928306,139.860389 40.614972,140.339139 41.260417,141.130833 40.872917,140.834556 41.419139,141.463306 41.431222,142.070444 39.547528,141.52625 38.274944,140.91875 38.2,140.982056 36.995,140.559528 36.279139,140.864583 35.692444,139.890028 34.89875,140.127111 35.570778,139.781611 35.672889,139.680444 35.140833,139.170833 35.254583,138.844944 34.600389,138.744139 35.132889,138.229194 34.595389,137.015833 34.578694,137.374611 34.78,136.982444 34.962889,136.889944 34.719556,136.7125 35.054556,136.502861 34.652528,136.899556 34.276667,136 33.710417)),((0 50.787944,-0.005 50.787889,-3.476694 50.687056,-3.643361 50.218694,-5.715889 50.061667,-4.230917 51.186639,-3.056722 51.177056,-2.347583 51.7975,-3.403417 51.380389,-5.320833 51.860806,-3.9375 52.553333,-4.058361 52.922944,-4.769167 52.795,-4.199167 53.212472,-2.680861 53.354972,-3.107556 53.545861,-2.799278 54.239944,-3.151694 54.061194,-3.642528 54.508333,-3.052556 54.982472,-4.856722 54.86875,-4.856722 54.63125,-5.145833 54.854944,-4.884194 55.942472,-4.427528 55.903306,-4.75175 56.207083,-5.315889 55.851639,-5.805861 55.3025,-5.004167 56.712472,-6.229167 56.725833,-5.387528 57.108306,-5.814222 57.855,-5.072528 57.819139,-5.003361 58.627917,-3.022472 58.643333,-4.438361 57.486194,-1.819167 57.610833,-2.53925 56.566639,-3.377528 56.380833,-2.595861 56.2675,-3.849139 56.117472,-2.137556 55.915806,-1.212556 54.580833,-0.077528 54.119944,0 53.763879,2.8e-05 53.76375,0 53.763748,-0.780833 53.695833,-0.224194 53.650806,0 53.543722,-0.007528 52.884972,0 52.887507,0.028278 52.897028,1.301611 52.933722,1.765806 52.478333,0.932528 51.590806,0.254167 51.465861,1.426611 51.392889,1.394194 51.153306,0 50.787944)),((-55.201556 46.998889,-55.201667 46.998333,-55.991139 46.953389,-54.70375 47.671639,-56.131222 47.464278,-55.790278 47.964472,-56.8565 47.527306,-58.317306 47.789111,-59.167611 47.564806,-59.41225 47.896278,-58.274611 48.513278,-59.270361 48.466583,-58.407556 49.130361,-57.892917 48.955778,-58.237139 49.393306,-57.705472 49.455833,-57.410861 50.702472,-55.901667 51.631222,-55.494222 51.3725,-56.08425 51.363306,-55.730833 51.093333,-56.871333 49.5425,-56.160056 50.15625,-56.209194 49.925417,-55.474667 49.967472,-56.140889 49.431278,-55.159639 49.544944,-55.395861 49.042083,-54.479194 49.570389,-54.498389 49.25625,-53.504139 49.283722,-54.19875 48.384972,-53.002889 48.546667,-53.963389 48.232889,-53.612139 48.054167,-53.942694 47.855917,-53.559889 47.519111,-52.920861 48.172861,-53.282583 47.54725,-52.793667 47.809972,-52.621694 47.524417,-53.161528 46.625722,-53.625056 46.641333,-53.553194 47.2185,-54.200417 46.821111,-53.793944 47.439056,-54.085444 47.879139,-55.201556 46.998889)),((-17 63.793722,-16.999278 63.793306,-18.733389 63.390361,-21.053306 63.941222,-22.704278 63.800806,-21.355917 64.387472,-24.045861 64.888306,-21.80175 65.026222,-22.604139 65.186639,-21.680889 65.455861,-24.527583 65.5025,-23.772528 65.534167,-24.096611 65.807083,-23.257583 65.678361,-23.470111 66.198722,-22.432472 65.833333,-23.136694 66.432056,-21.3225 66.008333,-21.086694 65.157917,-20.421139 66.08875,-19.405056 65.717056,-18.786667 66.195389,-18.05175 65.647944,-18.270056 66.177056,-16.575083 66.08375,-16.193333 66.540417,-15.398333 66.159583,-14.52675 66.380417,-15.184222 66.106667,-13.490861 65.0775,-14.2325 65.035028,-13.680806 64.914167,-14.958361 64.240417,-17 63.793722)),((-8 51.858722,-8.001667 51.857889,-9.775028 51.444583,-9.458361 51.729556,-10.164194 51.611639,-9.555861 51.8825,-10.404222 51.843333,-9.759194 52.156639,-10.363417 52.235417,-8.697556 52.653278,-9.940889 52.557472,-8.879167 53.208278,-10.184139 53.408278,-9.550861 53.800806,-10.114222 54.240806,-8.518417 54.211222,-8.115861 54.649139,-8.810917 54.699139,-7.985056 55.226194,-7.630111 54.962056,-7.388417 55.381222,-6.922528 55.236639,-7.315028 55.006194,-6.141722 55.227861,-5.430889 54.484111,-6.399167 54.013333,-6.31425 52.240833,-8 51.858722)))'));

DROP TABLE IF EXISTS multipolygon_test2;
CREATE TABLE multipolygon_test2 ( multipolygon geography(MULTIPOLYGON,4326));
INSERT INTO multipolygon_test2 VALUES (ST_GeogFromText('srid=4326;MULTIPOLYGON(((146.230028 -38.697083,146.276222 -39,145.371639 -38.539611,145.488306 -38.235444,144.658361 -38.311278,145.116278 -38.148333,144.928306 -37.842917,143.556639 -38.85875,140.581667 -38.032917,139.740361 -37.183306,139.612111 -36.156722,139.722472 -36.288806,139.517556 -35.96125,138.890806 -35.53375,138.097861 -35.626694,138.567861 -34.826667,138.094194 -34.135417,137.762556 -35.117944,136.851694 -35.285417,137.015833 -34.895444,137.452944 -34.908333,137.450444 -34.140028,137.977917 -33.553361,137.754139 -32.458778,137.781 -33,135.933722 -34.534194,135.9575 -35.007917,135.112889 -34.59,135.51875 -34.614194,134.707917 -33.181667,134.059611 -32.914139,134.181667 -32.485417,131.152472 -31.464583,125.9575 -32.288778,124.234139 -33.019583,123.526667 -33.937972,119.903361 -33.934583,117.953306 -35.128778,116.624139 -35.057944,115.128306 -34.372944,115.000417 -33.528361,115.697917 -33.300861,115.882944 -31.961694,115.052111 -30.507528,114.867056 -29.114194,113.152861 -26.149194,113.837917 -26.591667,113.509111 -25.505417,113.722083 -26.200028,113.870806 -25.942083,114.231222 -26.315889,113.39625 -24.406694,113.990417 -21.872528,114.330028 -22.522139,114.645833 -21.837917,116.804167 -20.523778,117.377472 -20.777083,119.092472 -19.957917,121.113306 -19.539611,122.369556 -18.1175,122.172917 -17.263333,122.922528 -16.387944,123.566722 -17.627083,123.569528 -17.037556,123.930806 -17.267917,123.971278 -16.825833,123.504583 -16.6625,123.5575 -16.17375,124.400028 -16.565444,124.97625 -16.381722,124.391306 -16.339222,124.750389 -15.810889,124.495 -16.002972,124.360417 -15.670028,124.675028 -15.254583,125.249583 -15.581667,124.829556 -15.157472,125.506694 -15.172056,125.137889 -14.745833,125.614167 -14.230472,125.918361 -14.677083,126.009167 -13.920389,126.230028 -14.250417,126.535806 -13.932083,126.612528 -14.250417,126.874972 -13.747139,127.428333 -13.942944,128.227056 -14.714194,128.009972 -15.51375,128.128333 -15.18625,128.372139 -15.496694,128.199583 -15.069222,128.559139 -14.766278,129.092528 -14.904611,129.125861 -15.281278,129.29 -14.862083,129.605833 -15.20625,129.998778 -14.705861,129.365417 -14.339972,129.816639 -13.499583,130.317972 -13.373333,130.351222 -12.670028,130.732083 -12.728333,130.575833 -12.407111,130.964972 -12.671278,130.812139 -12.408333,131.287528 -12.045444,131.4625 -12.285444,132.762944 -12.154583,132.722972 -11.623333,131.767889 -11.325833,131.973333 -11.127111,133.508333 -11.879583,133.915833 -11.742083,134.150889 -12.174583,134.748389 -11.95125,135.215389 -12.300861,135.9125 -11.952917,135.652889 -12.206667,136.045 -12.064611,136.016694 -12.498778,136.564139 -11.879611,136.977972 -12.348333,136.462083 -12.7775,136.461667 -13.253778,135.909556 -13.285,136.072111 -13.667528,135.411222 -14.934972,136.676667 -15.926306,139.036639 -16.912917,139.598361 -17.538778,140.609167 -17.613806,141.667028 -15.040861,141.46125 -13.852528,141.976833 -12.594778,141.586222 -12.558361,142.079611 -11.985861,142.130389 -10.961694,142.534167 -10.688722,143.545417 -12.844167,143.772917 -14.399194,144.515056 -14.16625,145.347889 -14.949194,145.402139 -16.435,145.957889 -16.897528,146.260444 -18.863389,148.772944 -20.236694,149.630472 -22.585,149.8125 -22.382111,150.060417 -22.658361,150.041667 -22.125417,150.635861 -22.660444,150.668306 -22.347083,150.791667 -23.509611,151.769556 -24.020861,153.192944 -25.931694,153.024583 -27.294194,153.639583 -28.638361,153.065417 -31.058389,152.359556 -32.186667,152.542944 -32.444222,151.201222 -33.510833,150.602944 -34.865833,150.842944 -35.066694,150.152972 -35.700972,149.979611 -37.505056,147.657472 -37.850444,147.454139 -38.079611,147.972083 -37.893361,146.230028 -38.697083)),((115 -4.014583,114.998361 -4.016278,114.594583 -4.1675,114.530833 -3.350472,113.635028 -3.464611,113.614167 -3.149611,113.022222 -2.93825,111.9025 -3.569611,111.701639 -2.802917,110.259167 -2.96625,109.955389 -1.108389,109.430833 -1.287083,109.640389 -0.986667,109.244611 -0.660833,109.59125 -0.740028,109.110417 -0.515056,109.282083 0.008333,108.910389 0.321611,108.907056 1.160833,109.64175 2.083944,109.892333 1.697917,111.170778 1.364583,111.433306 2.707056,113.035 3.167917,113.971667 4.601222,115.375889 4.906111,115.607111 5.229972,115.370417 5.410806,115.86375 5.580833,116.745861 7.034528,116.813333 6.549583,117.15075 7.007917,117.737889 6.424139,117.558056 5.902194,118.007472 6.064556,117.940806 5.669556,118.35 5.829583,119.262139 5.360028,118.123722 4.883333,118.550806 4.352083,117.359556 4.162444,117.768306 3.647917,117.013722 3.596667,118.094583 2.313333,117.734556 2.189167,117.843722 1.862472,118.999583 0.984167,118.364139 0.800389,117.888722 1.12,118.036222 0.786667,117.462056 0.090833,117.614583 -0.780833,116.8975 -1.271278,116.702083 -1.085,116.165444 -1.803361,116.60125 -2.195833,116.312917 -2.960833,116.099583 -2.862528,116.277917 -3.130028,115 -4.014583)),((44.999139 -25.487083,44.998306 -25.487083,44.027056 -25,43.230417 -22.325028,43.497889 -21.3125,44.483778 -19.9875,43.929583 -17.496667,44.437472 -16.190417,46.175 -15.70375,46.502472 -15.997944,46.472472 -15.510417,46.958278 -15.201278,46.891222 -15.608361,47.209556 -15.471694,47.047083 -15.178389,47.463306 -14.671278,47.486667 -15.088778,47.762111 -14.249167,48.042028 -14.265028,47.892917 -13.594167,48.264111 -13.817111,48.812056 -13.379167,48.720389 -12.442528,49.272528 -11.954583,49.19125 -12.305,49.930389 -13.044222,50.465417 -15.447528,50.161611 -15.996278,49.897528 -15.435417,49.621194 -15.539194,49.837083 -16.839194,49.44375 -17.211667,49.430389 -18.164194,47.101222 -24.993333,44.999139 -25.487083)),((-65.999139 61.954944,-65.998389 61.953722,-71.641083 63.13325,-72.120889 63.442139,-71.200028 63.594222,-72.639528 63.845111,-73.283639 64.660417,-73.576944 64.313833,-74.606889 64.902361,-74.460556 64.383778,-78.030139 64.427389,-77.376444 65.4715,-75.803 65.233889,-73.471611 65.44775,-74.457833 66.165167,-73.071611 66.720694,-72.051722 66.670194,-73.004694 66.778722,-72.152694 67.270389,-73.660667 68.664806,-74.230833 68.519306,-75.472472 69.027,-76.646556 68.694917,-75.588222 69.235694,-76.195667 69.672528,-77.188833 69.641972,-76.993306 69.98875,-77.627194 69.748611,-78.986083 70.708,-79.600833 70.374417,-78.794611 69.887972,-81.728417 70.14575,-80.932861 69.721167,-83.029444 70.314556,-81.761167 69.874278,-85.819278 70.009333,-86.381778 70.528222,-87.858139 70.239972,-88.792556 70.498111,-89.530833 71.091028,-85 71.204972,-84.772417 70.932972,-84.480806 71.637417,-86.03875 72.021083,-85.225806 72.266611,-84.148889 72.006556,-85.701639 72.904722,-83.951556 72.747139,-85.543 73.033083,-83.698417 73.007222,-85 73.348056,-81.548056 73.724028,-80.225694 72.736194,-80.962306 71.883944,-79.790417 72.504722,-77.730611 71.746444,-78.88125 72.234111,-77.003833 72.136056,-78.550222 72.438444,-77.575083 72.761917,-75.150194 72.490667,-76.401056 71.859222,-74.208667 72.061139,-75.365917 71.684361,-74.6165 71.659778,-75.047611 71.178778,-73.599194 71.779194,-73.855417 71.049389,-72.549889 71.660722,-71.154833 71.273083,-72.565833 70.615556,-70.604278 71.058972,-71.972528 70.419972,-71.165472 70.546444,-71.543028 70.0265,-69.884167 70.884111,-70.615278 70.457528,-69.447611 70.794861,-68.285611 70.525528,-70.177972 70.032333,-68.676389 70.207333,-70.023194 69.621167,-68.160528 70.318417,-67.259 69.972444,-67.205556 69.717917,-70.062222 69.542389,-67.230889 69.467528,-66.701139 69.170722,-69.040056 69.358,-68.083778 69.222972,-69.012083 68.977361,-68.199972 69.151722,-67.775667 68.78525,-69.408139 68.815139,-66.673889 68.446889,-67.882806 68.269194,-67.019028 68.331,-66.747889 67.932417,-66.314528 68.124556,-66.374222 67.768139,-65.940444 68.032667,-66.032889 67.596611,-65.803528 67.973056,-65.342833 67.588778,-64.721667 67.977917,-65.230167 67.642056,-64.53 67.810361,-63.950917 67.3425,-64.795 67.368722,-63.957472 67.266639,-64.720111 67.007889,-63.500056 67.235389,-63.813306 66.900389,-63.118306 67.332056,-63.809972 66.804583,-62.84175 66.967889,-62.733472 66.656278,-62.02675 67.052917,-61.292528 66.667444,-62.197528 66.614972,-61.543389 66.318694,-62.895944 66.334139,-61.949194 66,-62.949194 66.146694,-62.676722 65.574611,-63.529222 65.929972,-63.53675 64.876222,-65.501528 65.740694,-64.358389 66.355444,-65.874583 65.944111,-65.481 66.385694,-65.98525 66.10725,-66.737528 66.597361,-67.939778 66.633611,-67.132722 66.01825,-68.367472 66.072667,-68.235972 65.427556,-67.316111 65.665278,-66.730667 64.72075,-66.676694 65.041778,-66.314389 64.610139,-65.68675 64.848444,-65.040194 64.43075,-65.671444 64.303111,-64.612611 63.976667,-64.51675 63.242056,-65.315917 63.805194,-64.897528 62.631667,-67.915167 63.7695,-67.688528 63.368944,-68.983389 63.755861,-65.999139 61.954944)),((103.999139 -5.325444,103.998361 -5.324583,101.581278 -3.204222,100.324583 -0.854167,99.136222 0.253306,98.797056 1.730806,97.750861 2.276222,96.867056 3.694972,95.537111 4.661667,95.227528 5.582944,97.503306 5.255389,98.28875 4.430833,98.155833 4.084556,99.753306 3.179528,100.933278 1.809556,101.047472 2.302917,102.413333 0.805361,102.909972 0.717083,103.10625 0.455861,102.6825 0.225361,103.327472 0.549556,103.72875 0.280806,103.276222 -0.705861,104.367472 -1.017917,104.479556 -1.99,104.87875 -2.084222,104.712917 -2.6,104.847472 -2.284583,105.619139 -2.392111,106.087056 -3.225806,105.723333 -5.904639,105.284167 -5.446278,105.160833 -5.809611,104.529944 -5.522111,104.581694 -5.945444,103.999139 -5.325444)),((136 33.710417,135.997889 33.708306,135.753333 33.436222,135.057889 33.881694,135.336667 34.725389,134.185833 34.741222,132.556667 34.069583,132.400806 34.37625,132.139139 33.83125,130.905 33.912889,130.866278 34.291667,133.092472 35.607056,136.070833 35.662056,136.756667 37.36375,137.345389 37.515806,136.860389 37.081667,137.331694 36.762944,139.425028 38.148722,140.103722 39.679167,140.070028 39.998778,139.703694 39.928306,139.860389 40.614972,140.339139 41.260417,141.130833 40.872917,140.834556 41.419139,141.463306 41.431222,142.070444 39.547528,141.52625 38.274944,140.91875 38.2,140.982056 36.995,140.559528 36.279139,140.864583 35.692444,139.890028 34.89875,140.127111 35.570778,139.781611 35.672889,139.680444 35.140833,139.170833 35.254583,138.844944 34.600389,138.744139 35.132889,138.229194 34.595389,137.015833 34.578694,137.374611 34.78,136.982444 34.962889,136.889944 34.719556,136.7125 35.054556,136.502861 34.652528,136.899556 34.276667,136 33.710417)),((0 50.787944,-0.005 50.787889,-3.476694 50.687056,-3.643361 50.218694,-5.715889 50.061667,-4.230917 51.186639,-3.056722 51.177056,-2.347583 51.7975,-3.403417 51.380389,-5.320833 51.860806,-3.9375 52.553333,-4.058361 52.922944,-4.769167 52.795,-4.199167 53.212472,-2.680861 53.354972,-3.107556 53.545861,-2.799278 54.239944,-3.151694 54.061194,-3.642528 54.508333,-3.052556 54.982472,-4.856722 54.86875,-4.856722 54.63125,-5.145833 54.854944,-4.884194 55.942472,-4.427528 55.903306,-4.75175 56.207083,-5.315889 55.851639,-5.805861 55.3025,-5.004167 56.712472,-6.229167 56.725833,-5.387528 57.108306,-5.814222 57.855,-5.072528 57.819139,-5.003361 58.627917,-3.022472 58.643333,-4.438361 57.486194,-1.819167 57.610833,-2.53925 56.566639,-3.377528 56.380833,-2.595861 56.2675,-3.849139 56.117472,-2.137556 55.915806,-1.212556 54.580833,-0.077528 54.119944,0 53.763879,2.8e-05 53.76375,0 53.763748,-0.780833 53.695833,-0.224194 53.650806,0 53.543722,-0.007528 52.884972,0 52.887507,0.028278 52.897028,1.301611 52.933722,1.765806 52.478333,0.932528 51.590806,0.254167 51.465861,1.426611 51.392889,1.394194 51.153306,0 50.787944)),((-8 51.858722,-8.001667 51.857889,-9.775028 51.444583,-9.458361 51.729556,-10.164194 51.611639,-9.555861 51.8825,-10.404222 51.843333,-9.759194 52.156639,-10.363417 52.235417,-8.697556 52.653278,-9.940889 52.557472,-8.879167 53.208278,-10.184139 53.408278,-9.550861 53.800806,-10.114222 54.240806,-8.518417 54.211222,-8.115861 54.649139,-8.810917 54.699139,-7.985056 55.226194,-7.630111 54.962056,-7.388417 55.381222,-6.922528 55.236639,-7.315028 55.006194,-6.141722 55.227861,-5.430889 54.484111,-6.399167 54.013333,-6.31425 52.240833,-8 51.858722)))'));

SELECT ST_Distance( point, multipolygon, false)
FROM points_test, multipolygon_test
limit 2;

The error does not occur if I use limit=1 (last line) or the smaller multipolygon multipolygon_test2 that includes less polygons. The multipolygons are parts of a world shape file (gshhs_c_l1). I could not find a decisive attribute of the multipolygon that causes the error. It is not a special number of polygons or a special polygon within the multipolygon.

I use version (PostGIS_full_version()):
POSTGIS="2.4.4 r16526"
PGSQL="100"
GEOS="3.7.1-CAPI-1.11.1 27a5e771"
PROJ="Rel. 4.9.3, 15 August 2016"
GDAL="GDAL 2.2.3, released 2017/11/20"
LIBXML="2.9.4"
LIBJSON="0.12.1"
LIBPROTOBUF="1.2.1"
TOPOLOGY RASTER

Change History (4)

comment:1 by robe, 4 years ago

Milestone: PostGIS 2.4.9

comment:2 by johannesrummel, 4 years ago

Changing the order of the points in points_test avoids the error. The error occures if:

  • the calculated distance of the second point is 0 (as it is for ST_Point( 100, 0))
  • there are more than one point with distance 0

comment:3 by robe, 4 years ago

Okay I tried this on 2.4.7dev (latest 2.4 stable branch) and I get a BOOM.

However in 2.5.5 latest stable-2.5 branch, no BOOM BOOM.

Should we just consider this fixed in 2.5 and accept we won't fix in 2.4, or back-port the change whatever that change is?

comment:4 by robe, 4 years ago

Milestone: PostGIS 2.4.9PostGIS 2.5.5
Resolution: fixed
Status: newclosed

Hearing no interest in fixing thisi in 2.4, I'm going to mark this as fixed in 2.5.5. I'm not sure it was ever an issue in 2.5 though.

Note: See TracTickets for help on using tickets.