<html><head><meta http-equiv="content-type" content="text/html; charset=GB2312"><style>body { line-height: 1.5; }body { font-size: 10.5pt; font-family: ΛΞΜε; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span><span style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;">Dear All,</span></div><div><span style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;"><br></span></div><div><span style="font-family: 'ΞΆΘνΡΕΊΪ, Tahoma';">When calculating the distance between geometry or geography by the function ST_Distance, I found the following error:<br>ERROR: cannot update SecondarySnapshot during a parallel operation<br>CONTEXT: SQL statement "SELECT proj4text FROM public.spatial_ref_sys WHERE srid = 4326 LIMIT 1"<br>Parallel worker<br><br>1. Test environment<br>centOS7.3 x64<br>PostgreSQL 10.7<br>PostGIS 2.5.1<br>RECORDS OF TARGET TABLE:1000000+<br><br>2. Execute SQL<br><br>```<br>test=# \d info_test<br>                       Table "public.info_test"<br>     Column     |          Type          | Collation | Nullable | Default <br>----------------+------------------------+-----------+----------+---------<br> id             | bigint                 |           | not null | <br> loc            | geometry               |           |          | <br>Indexes:<br>    "pk_info_test" PRIMARY KEY, btree (id)<br>    "idx_info_test" gist (loc)<br>test=# SELECT ST_Distance(loc, ST_SetSRID(ST_Point(118.813933,32.051875),4326), false)::int as distance<br>FROM info_test<br>ORDER BY distance limit 10;<br>ERROR:  cannot update SecondarySnapshot during a parallel operation<br>CONTEXT:  SQL statement "SELECT proj4text FROM public.spatial_ref_sys WHERE srid = 4326 LIMIT 1"<br>parallel worker<br>```<br><br>3. Investigation<br>A)By setting the parameter max_parallel_workers and max_parallel_workers_per_gather to 0 and then executing the SQL, SQL can execute normally.<br></span></div><div>B)<span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">We try to reproduce this phenomenon, it only happens occasionally when specific data is available. The probability of occurrence is very low.</span></div><div><span style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;"><br></span></div><div><span style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;">I am looking forward for your reply.</span><br style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;"><span style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;"> </span><br style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;"><span style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;">Best Regards,</span><br style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;"><span style="font-family: ΞΆΘνΡΕΊΪ, Tahoma; line-height: normal;">LIANGBO</span></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left"><font size="3"><span style="line-height: normal;">LIANGBO</span></font><div></div>
</body></html>