I am guessing you used pg_pathman or other extensions in addition to postgis?
Postgis use SPI_exec() to execute sql statement "SELECT proj4text FROM public.spatial_ref_sys WHERE srid = 4326 LIMIT 1” in each worker progress in postgres parallel query, pg_pathman will rewrite the query plan by pg_pathman planner hook and GetLatestSnapshot. But in parallel query, the snapshot of each worker progress is the same as leader progress, the worker progress is not necessary to get the latest snapshot, that’s the problem. I think it’s a bug of pg_pathman, there’s a pg_pathman issue for detail: https://github.com/postgrespro/pg_pathman/issues/215
Eric Wong.
On 08/5/2020 11:02,fuzk<fuzk80_76@xxxxxxx> wrote:
Dear Sir/MadamI got an error when I execute the following select sentence.Would you please solve the problem for me?Thank you .Alan Fu.postgres=# \set VERBOSITY verbosepostgres=# SELECT round(cast(coalesce(sum(ST_length(geography(geometry)))/1000,0) as NUMERIC),4)||'KM' field_value from had_link;ERROR: XX000: cannot update SecondarySnapshot during a parallel operation
CONTEXT: SQL statement "SELECT proj4text FROM public.spatial_ref_sys WHERE srid = 4326 LIMIT 1"
parallel worker
LOCATION: GetLatestSnapshot, snapmgr.c:387