Re: postgres_fdw batching vs. (re)creating the tuple slots

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postgres_fdw batching vs. (re)creating the tuple slots
Date: 2021-06-16 14:23:18
Message-ID: f5c7b426-b112-8a72-0271-2eb21f3123ac@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 6/16/21 2:36 PM, Alexander Pyhalov wrote:
>
> Hi.
> It seems this commit
>
> commit b676ac443b6a83558d4701b2dd9491c0b37e17c4
> Author: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
> Date:   Fri Jun 11 20:19:48 2021 +0200
>
>     Optimize creation of slots for FDW bulk inserts
>
> has broken batch insert for partitions with unique indexes.
>

Thanks for the report and reproducer!

Turns out this is a mind-bogglingly silly bug I made in b676ac443b :-(
The data is copied into the slots only in the branch that initializes
them, so the subsequent batches just insert the same data over and over.

The attached patch fixes that, and adds a regression test (a bit smaller
version of your reproducer). I'll get this committed shortly.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
batch-fix.patch text/x-patch 5.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Guo 2021-06-16 14:23:53 Re: Should wal receiver reply to wal sender more aggressively?
Previous Message Tom Lane 2021-06-16 14:03:52 Re: Improving isolationtester's data output