Re: ERROR: cannot start subtransactions during a parallel operation - Mailing list pgsql-hackers

From Andres Freund
Subject Re: ERROR: cannot start subtransactions during a parallel operation
Date
Msg-id 20180629172222.liaq6giboqeozwek@alap3.anarazel.de
Whole thread Raw
In response to Re: ERROR: cannot start subtransactions during a parallel operation  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: ERROR: cannot start subtransactions during a parallel operation
List pgsql-hackers
On 2018-06-29 16:50:47 +0200, Tomas Vondra wrote:
> On 06/29/2018 04:00 PM, Mai Peng wrote:
> > Hello,
> > 
> > On a pG10.4 instance, my query ( a simple select from a view) throw this
> > error:
> > ERROR:  cannot start subtransactions during a parallel operation
> > CONTEXT:  PL/pgSQL function check_validity(ltree[]) line 4 during
> > statement block entry
> > 
> 
> So, what does this check_validity function do? It's not part of PostgreSQL,
> and it apparently tries to do something that opens a subtransation. Like a
> SAVEPOINT for example ...
> 
> > But prefixing this query by "set max_parallel_workers_gather=0" make it
> > works.
> > 
> > When I take off the column that is checked by a function, no need to add
> > set max_parallel_workers_gather=0 .
> > 
> 
> Well, that's not really surprising - if you disable parallelism the query is
> no longer subject to the restriction about subtransactions.
> 
> > How could I continue to use the default max_parallel_workers_gather (2).
> > 
> 
> Modity the function not to start a subtransaction.

Wouldn't the right fix be to adjust the parallel safety of the function?

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Vik Fearing
Date:
Subject: Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query
Next
From: "Regina Obe"
Date:
Subject: RE: Regression on PostgreSQL 10 ORDER/GROUP BY expression not found in targetlist