pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ilya Knyazev <knuazev@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18775: PQgetCopyData always has an out-of-memory error if the table field stores bytea ~700 MB
Date: Thu, 16 Jan 2025 14:18:06 -0500
Message-ID: <1849376.1737055086@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFqQ4ZWyUwwwgHA+BBGiLKbmm+SaRPJZQSgOHajDa+AB+igfRA@mail.gmail.com>
References: <18775-e6af405ca08393cc@postgresql.org>
	<1623899.1737043379@sss.pgh.pa.us>
	<CAFqQ4ZWyUwwwgHA+BBGiLKbmm+SaRPJZQSgOHajDa+AB+igfRA@mail.gmail.com>

Ilya Knyazev <knuazev@gmail.com> writes:
> But I know that there may not be enough memory, so I use the "copy" keyword
> in the query and the PQgetCopyData function. I thought that this function
> was designed for portioned work. By analogy with the PQputCopyData
> function, which works fine.

Its documentation is fairly clear, I thought:

       Attempts to obtain another row of data from the server during a
       <command>COPY</command>.  Data is always returned one data row at
       a time; if only a partial row is available, it is not returned.

If you need to work with data values that are large enough to risk
memory problems, I think "large objects" are the best answer.  Their
interface is a bit clunky, but it's at least designed to let you
both read and write by chunks.

			regards, tom lane





view thread (4+ messages)

Message-ID: <1849376.1737055086@sss.pgh.pa.us>
Permalink:  ../1849376.1737055086@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1849376.1737055086@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, knuazev@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18775: PQgetCopyData always has an out-of-memory error if the table field stores bytea ~700 MB
  In-Reply-To: <1849376.1737055086@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox