Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM - Mailing list pgsql-hackers

From Kirill Reshke
Subject Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM
Date
Msg-id CALdSSPhsEYaAgSG=1Utj2MOTgy3u2sp_QPr6sJthhACtRrF=0g@mail.gmail.com
Whole thread Raw
In response to [PATCH] Add enable_copy_program GUC to control COPY PROGRAM  (Ignat Remizov <ignat980@gmail.com>)
Responses Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM
List pgsql-hackers


On Fri, 5 Dec 2025, 12:32 Michael Banck, <mbanck@gmx.net> wrote:
Hi,

On Wed, Dec 03, 2025 at 11:29:09PM +0500, Kirill Reshke wrote:
> On Wed, 3 Dec 2025 at 23:17, I wrote:
> > (I did derive the exact example
> > when postgresql immediately restarts after some SQL but im 100% there
> > is such thing )
>
> select repeat('a',1024*1024*1023) from generate_series(1, 100);

I get

out of memory for query result

I guess it depends on whether you have memory overcommit on or off,
and/or whether you run in a container/Kubernetes. Or maybe it depends on
something else.

This denial of service is a different problem, and I agree that Postgres
desperately needs a way to limit memory allocations per user (one can
set work_mem as high as 1.999TB as regular user) and globally.


Michael


The idea here is that you get OOM which will lead to restart.
Aslo you can change archive command to 'shutdown'.

pgsql-hackers by date:

Previous
From: Michael Banck
Date:
Subject: Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM
Next
From: Michael Paquier
Date:
Subject: Re: Consistently use palloc_object() and palloc_array()