Re: [HACKERS] Add support for tuple routing to foreign partitions
Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Stephen Frost <sfrost@snowman.net>,
Alvaro Herrera <alvherre@alvh.no-ip.org>,
Maksim Milyutin <milyutinma@gmail.com>,
Robert Haas <robertmhaas@gmail.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2018-03-20T11:55:07Z
Lists: pgsql-hackers
Hi Amit, (2018/03/20 15:57), Amit Langote wrote: > On 2018/03/19 20:25, Amit Langote wrote: >> That's all I have for now. Will reply to your previous email. > While testing this patch, I noticed a crash when performing EXPLAIN on > update of a partition tree containing foreign partitions. Crash occurs in > postgresEndForeignRouting() due to the following Assert failing: > > Assert(fmstate != NULL); > > It seems the problem is that ExecCleanupTupleRouting() invokes the > EndForeignRouting() function even if ri_PartitionIsValid is not set. So I > suppose we need this: > > /* > - * If this is INSERT/UPDATE, allow any FDWs to shut down > + * If this is INSERT/UPDATE, allow any FDWs to shut down if it has > + * initialized tuple routing information at all. > */ > if (node&& > + resultRelInfo->ri_PartitionIsValid&& > resultRelInfo->ri_FdwRoutine != NULL&& > resultRelInfo->ri_FdwRoutine->EndForeignRouting != NULL) > resultRelInfo->ri_FdwRoutine->EndForeignRouting(node->ps.state, Will look into this. > BTW,patch needs to be rebased because of two commits this morning: > 6666ee49f [1] and ee0a1fc84 [2]. Will do. Thanks for reviewing the patch! Best regards, Etsuro Fujita
Commits
-
Allow insert and update tuple routing and COPY for foreign tables.
- 3d956d9562aa 11.0 landed
-
Refactor PgFdwModifyState creation/destruction into separate functions.
- 870d89608e5f 11.0 landed