Re: Allow batched insert during cross-partition updates - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Allow batched insert during cross-partition updates
Date
Msg-id CA+HiwqHhgTA+U7gkjnZE8KYYVss5awdwvkOgbkb3qrxUjWm60A@mail.gmail.com
Whole thread Raw
In response to Re: Allow batched insert during cross-partition updates  (Zhihong Yu <zyu@yugabyte.com>)
Responses Re: Allow batched insert during cross-partition updates
List pgsql-hackers
On Mon, Apr 5, 2021 at 1:16 AM Zhihong Yu <zyu@yugabyte.com> wrote:
>
> Hi,
> In the description:
>
> cross-partition update of partitioned tables can't use batching
> because ExecInitRoutingInfo() which initializes the insert target
>
> 'which' should be dropped since 'because' should start a sentence.
>
> +-- Check that batched inserts also works for inserts made during
>
> inserts also works -> inserts also work
>
> +       Assert(node->rootResultRelInfo->ri_RelationDesc->rd_rel->relkind ==
> +              RELKIND_PARTITIONED_TABLE);
>
> The level of nested field accesses is quite deep. If the assertion fails, it would be hard to know which field is
null.
> Maybe use several assertions:
>        Assert(node->rootResultRelInfo)
>        Assert(node->rootResultRelInfo->ri_RelationDesc)
>        Assert(node->rootResultRelInfo->ri_RelationDesc->rd_rel->relkind == ...

Thanks for taking a look at this.

While I agree about having the 1st Assert you suggest, I don't think
this code needs the 2nd one, because its failure would very likely be
due to a problem in some totally unrelated code.

Updated patch attached.  I had to adjust the test case a little bit to
account for the changes of 86dc90056d, something I failed to notice
yesterday.  Also, I expanded the test case added in postgres_fdw.sql a
bit to show the batching in action more explicitly.

--
Amit Langote
EDB: http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Confusing behavior of psql's \e
Next
From: Bharath Rupireddy
Date:
Subject: Re: Allow batched insert during cross-partition updates