Re: postgres_fdw: Use COPY to speed up batch inserts
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Matheus Alcantara <matheusssilv97@gmail.com>
Cc: Tomas Vondra <tomas@vondra.me>, pgsql-hackers@postgresql.org
Date: 2025-10-23T09:49:13Z
Lists: pgsql-hackers
On Thu, Oct 23, 2025 at 8:01 AM Matheus Alcantara <matheusssilv97@gmail.com> wrote: > > Please see the attached v3 version that implements this idea. > hi. I am not famailith with this module. some of the foreach can be replaced with foreach_int. I suspect that somewhere Form_pg_attribute.attisdropped is not handled properly. the following setup will crash. ---source database drop table batch_table1; create table batch_table1(x int); ---foreign table database drop foreign table if exists ftable1; CREATE FOREIGN TABLE ftable1 ( x int ) SERVER loopback1 OPTIONS ( table_name 'batch_table1', batch_size '10' ); ALTER FOREIGN TABLE ftable1 DROP COLUMN x; ALTER FOREIGN TABLE ftable1 add COLUMN x int; INSERT INTO ftable SELECT * FROM generate_series(1, 10) i; --- this will cause server crash.