Re: Using COPY via pg_background extension

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Oleg Dushin <oleg(dot)dushin(at)pbs-software(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Using COPY via pg_background extension
Date: 2026-02-24 16:28:20
Message-ID: a148d02f-a8db-47dd-bedb-8ecd44a3c211@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/24/26 8:13 AM, Oleg Dushin wrote:
> Hello everyone,
>
> I couldn't find anything on this topic in the mailing lists or in the
> documentation for the ‘pg_background’ extension.
>
> https://github.com/vibhorkum/pg_background?tab=readme-ov-file#known-
> limitations
>
> Perhaps I overlooked something.
>
> My question is: Is it possible to use the COPY protocol in combination
> with pg_background?
>
> More specifically, is it possible to load data from a file into a table
> via background worker process?
>
> COPY country FROM ‘/usr1/proj/bray/sql/country_data’;
>
> Would the following call or something similar be possible and achieve
> the desired result??
>
> pg_background_launch_v2(‘COPY country FROM ’/usr1/proj/bray/sql/
> country_data');

What happens when you try?

Though be aware that COPY needs server user access to the file.

If there is an error I would suggest reporting it here:

https://github.com/vibhorkum/pg_background/issues

>
> https://www.postgresql.org/docs/current/sql-copy.html
>
> Kind regards,
>
> Oleg
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul A Jungwirth 2026-02-24 16:57:42 Postgres Patch Review Workshop: March 2026
Previous Message Oleg Dushin 2026-02-24 16:13:15 Using COPY via pg_background extension