#3952: ST_Transform fails in parallel mode

Justin Pryzby pryzby at telsasoft.com
Fri Aug 9 12:59:59 PDT 2024


I hit this error and found a pre-existing bug report, but it's from 7
years ago, and marked as closed.
https://trac.osgeo.org/postgis/ticket/3952

ts=# begin; SET parallel_tuple_cost=0; SET parallel_setup_cost=0; CREATE TABLE rpt AS SELECT get_x(site_id, site_alias) FROM sites; rollback;
ts=# \errverbose 
ERROR:  XX000: cannot start commands during a parallel operation
CONTEXT:  SQL statement "select st_x(site_geo) AS x          from sites where site_id = s_id"
PL/pgSQL function get_x(integer,integer) line 7 at SQL statement
LOCATION:  CommandCounterIncrement, xact.c:1094

This is running postgres 16.3.
get_x is a local plpgsql function which runs SELECT INTO.

Let me know what else you need.  I can try to make a minimal reproducer but it
may be next week.

(gdb) bt
#0  pg_re_throw () at ./build/../src/backend/utils/error/elog.c:1966
#1  0x000055cc51718e26 in errfinish (filename=<optimized out>, lineno=<optimized out>, funcname=0x55cc5177a340 <__func__.29> "CommandCounterIncrement") at ./build/../src/backend/utils/error/elog.c:543
#2  0x000055cc51212f3d in CommandCounterIncrement () at ./build/../src/backend/access/transam/xact.c:1094
#3  0x000055cc5131bcde in CommandCounterIncrement () at ./build/../src/backend/access/transam/xact.c:1086
#4  0x000055cc51470745 in _SPI_execute_plan (plan=plan at entry=0x55cc535f3f10, options=options at entry=0x7ffcf9a8edc0, snapshot=snapshot at entry=0x0, crosscheck_snapshot=crosscheck_snapshot at entry=0x0, 
    fire_triggers=fire_triggers at entry=true) at ./build/../src/backend/executor/spi.c:2645
#5  0x000055cc51470fc3 in SPI_execute_plan_with_paramlist (plan=0x55cc535f3f10, params=0x55cc535ce3e8, read_only=<optimized out>, tcount=1) at ./build/../src/backend/executor/spi.c:749
#6  0x00007fc3d41497a5 in exec_stmt_execsql (estate=estate at entry=0x7ffcf9a8f280, stmt=stmt at entry=0x55cc535dd688) at ./build/../src/pl/plpgsql/src/pl_exec.c:4292
#7  0x00007fc3d414a93f in exec_stmts (estate=estate at entry=0x7ffcf9a8f280, stmts=0x55cc535dd6d0) at ./build/../src/pl/plpgsql/src/pl_exec.c:2091
#8  0x00007fc3d414ce22 in exec_stmt_block (estate=estate at entry=0x7ffcf9a8f280, block=block at entry=0x55cc535ddc80) at ./build/../src/pl/plpgsql/src/pl_exec.c:1942
#9  0x00007fc3d414cf0d in exec_toplevel_block (estate=estate at entry=0x7ffcf9a8f280, block=0x55cc535ddc80) at ./build/../src/pl/plpgsql/src/pl_exec.c:1633
#10 0x00007fc3d414d79f in plpgsql_exec_function (func=func at entry=0x55cc534c1830, fcinfo=fcinfo at entry=0x55cc535a4280, simple_eval_estate=simple_eval_estate at entry=0x0, simple_eval_resowner=simple_eval_resowner at entry=0x0, 
    procedure_resowner=procedure_resowner at entry=0x0, atomic=<optimized out>) at ./build/../src/pl/plpgsql/src/pl_exec.c:622
#11 0x00007fc3d41584c7 in plpgsql_call_handler (fcinfo=0x55cc535a4280) at ./build/../src/pl/plpgsql/src/pl_handler.c:277
#12 0x000055cc51430e7f in ExecInterpExpr (state=0x55cc535a3db0, econtext=0x55cc53599ed8, isnull=<optimized out>) at ./build/../src/backend/executor/execExprInterp.c:734
#13 0x000055cc51464250 in ExecEvalExprSwitchContext (isNull=0x7ffcf9a8f5b7, econtext=0x55cc53599ed8, state=0x55cc535a3db0) at ./build/../src/include/executor/executor.h:355
#14 ExecProject (projInfo=0x55cc535a3da8) at ./build/../src/include/executor/executor.h:389
#15 ExecResult (pstate=<optimized out>) at ./build/../src/backend/executor/nodeResult.c:136
#16 0x000055cc5143b509 in ExecProcNodeInstr (node=0x55cc53599dd0) at ./build/../src/backend/executor/execProcnode.c:480
#17 0x000055cc5144ee18 in ExecProcNode (node=0x55cc53599dd0) at ./build/../src/include/executor/executor.h:273
#18 gather_getnext (gatherstate=0x55cc53599bf8) at ./build/../src/backend/executor/nodeGather.c:295
#19 ExecGather (pstate=0x55cc53599bf8) at ./build/../src/backend/executor/nodeGather.c:227
#20 0x000055cc5143b509 in ExecProcNodeInstr (node=0x55cc53599bf8) at ./build/../src/backend/executor/execProcnode.c:480
#21 0x000055cc51434c05 in ExecProcNode (node=0x55cc53599bf8) at ./build/../src/include/executor/executor.h:273
#22 ExecutePlan (execute_once=<optimized out>, dest=0x55cc534b36b0, direction=<optimized out>, numberTuples=0, sendTuples=true, operation=CMD_SELECT, use_parallel_mode=<optimized out>, planstate=0x55cc53599bf8, 
    estate=0x55cc535999a0) at ./build/../src/backend/executor/execMain.c:1670
#23 standard_ExecutorRun (queryDesc=0x55cc53597c10, direction=<optimized out>, count=0, execute_once=<optimized out>) at ./build/../src/backend/executor/execMain.c:365
#24 0x00007fc3d423943d in pgss_ExecutorRun (queryDesc=0x55cc53597c10, direction=ForwardScanDirection, count=0, execute_once=<optimized out>) at ./build/../contrib/pg_stat_statements/pg_stat_statements.c:1010
#25 0x00007fc3d7d8671a in explain_ExecutorRun (queryDesc=0x55cc53597c10, direction=ForwardScanDirection, count=0, execute_once=<optimized out>) at ./build/../contrib/auto_explain/auto_explain.c:332
#26 0x000055cc513c1ba1 in ExecCreateTableAs (pstate=pstate at entry=0x55cc53441fe0, stmt=stmt at entry=0x55cc5346b750, params=params at entry=0x0, queryEnv=queryEnv at entry=0x0, qc=qc at entry=0x7ffcf9a90230)
    at ./build/../src/backend/commands/createas.c:336
#27 0x000055cc515e083c in ProcessUtilitySlow (pstate=pstate at entry=0x55cc53441fe0, pstmt=pstmt at entry=0x55cc5346b7e8, 
    queryString=queryString at entry=0x55cc5346a7f0 "CREATE TABLE rpt AS SELECT get_x(site_id, site_alias) FROM sites;", context=context at entry=PROCESS_UTILITY_TOPLEVEL, params=params at entry=0x0, queryEnv=queryEnv at entry=0x0, 
    qc=<optimized out>, dest=<optimized out>) at ./build/../src/backend/tcop/utility.c:1679
..


More information about the postgis-devel mailing list