On Wed, Oct 7, 2020 at 12:40 AM Bharath Rupireddy <bharath.rupireddyforpostg...@gmail.com> wrote: > > In parallel, we are not doing anything(due to the same reason > explained in above comment) to find whether there is a foreign > partition or not while deciding to go with parallel/non-parallel copy, > we are just throwing an error during the first tuple insertion into > the partition. > > errmsg("cannot perform PARALLEL COPY if partition has BEFORE/INSTEAD > OF triggers, or if the partition is foreign partition"), > errhint("Try COPY without PARALLEL option"))); >
I may well need to do something similar for parallel INSERT, but I'm kind of surprised it can't be detected earlier (?). Will need to further test this. > > Allowing the leader to execute before statement triggers at Gather > node level before invoking the parallel plan and then parallel inserts > makes sense. But if there are any after statement triggers, there may > come transition tables, see Amit's findings under Case-1 in [1] and we > must disable parallelism in that case. > > [1] - > https://www.postgresql.org/message-id/flat/CAA4eK1%2BANNEaMJCCXm4naweP5PLY6LhJMvGo_V7-Pnfbh6GsOA%40mail.gmail.com > The patch I last posted for parallel INSERT does detect use of transition tables in this case (trigdesc->trig_insert_new_table) and disables INSERT parallelism (I tested it against Amit's example), yet still otherwise allows AFTER STATEMENT triggers for parallel INSERT. Regards, Greg Nancarrow Fujitsu Australia