cannot start commands during a parallel operation

Paul Ramsey pramsey at cleverelephant.ca
Fri Aug 9 14:09:44 PDT 2024


> On Aug 9, 2024, at 1:49 PM, Justin Pryzby <pryzby at telsasoft.com> wrote:
> 
> On Fri, Aug 09, 2024 at 01:43:22PM -0700, Paul Ramsey wrote:
>> 
>> 
>>> On Aug 9, 2024, at 1:40 PM, Justin Pryzby <pryzby at telsasoft.com> wrote:
>>> 
>>> On Fri, Aug 09, 2024 at 01:19:22PM -0700, Paul Ramsey wrote:
>>>> Where’s the PostGIS content to this? The stack trace doesn’t hit and PostGIS code, and the SQL doesn’t call any PostGIS functions…?
>>> 
>>> Our get_x() calls postgis st_x().
>> 
>> And get_x() also does a transform along the way? Crazy that st_x() could cause any problems, it’s so simple.
> 
> I minimized our get_x() and reproduced with this:
> 

Crazy… it’s just a short little C function. Why wouldn’t this happen with every/any extension function?

https://github.com/postgis/postgis/blob/master/postgis/lwgeom_ogc.c#L609-L623


> ts=# \sf get_x_min 
> CREATE OR REPLACE FUNCTION public.get_x_min(integer, integer)
> RETURNS double precision
> LANGUAGE plpgsql
> PARALLEL SAFE
> AS $function$
>        DECLARE
>                s_id alias for $1;
>                rec record;
>        begin
>                select st_x(site_geo) AS x into rec from sites where site_id = s_id;
>                return rec.x;
>        end;
> $function$
> 
> ts=# SET parallel_tuple_cost=0; SET parallel_setup_cost=0; CREATE TEMP TABLE rpt AS SELECT get_x_min(site_id, site_alias) FROM sites;
> ERROR:  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_min(integer,integer) line 6 at SQL statement



More information about the postgis-devel mailing list