Re: Fast COPY FROM based on batch insert

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: Ian Barwick <ian(dot)barwick(at)enterprisedb(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, tanghy(dot)fnst(at)fujitsu(dot)com, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, houzj(dot)fnst(at)fujitsu(dot)com
Subject: Re: Fast COPY FROM based on batch insert
Date: 2022-07-08 15:09:35
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 8/7/2022 05:12, Ian Barwick wrote:
>     ERROR:  bind message supplies 0 parameters, but prepared statement
> "pgsql_fdw_prep_178" requires 6
>     CONTEXT:  remote SQL command: INSERT INTO public.foo_part_1(t, v1,
> v2, v3, v4, v5) VALUES ($1, $2, $3, $4, $5, $6)
>     COPY foo, line 88160
Thanks, I got it. MultiInsertBuffer are created on the first non-zero
flush of tuples into the partition and isn't deleted from the buffers
list until the end of COPY. And on a subsequent flush in the case of
empty buffer we catch the error.
Your fix is correct, but I want to propose slightly different change
(see in attachment).

Andrey Lepikhov
Postgres Professional

Attachment Content-Type Size
flush_nonzero_buffer.txt text/plain 1.2 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Jingtang Zhang 2022-07-08 15:31:20 Two successive tabs in test case are causing syntax error in psql
Previous Message Robert Haas 2022-07-08 15:04:20 Re: [PATCH] fix wait_event of pg_stat_activity in case of high amount of connections