Invalid memory allocation error with pg_recvlogical or with libPQ logical connection

From: jitesh tiwari <jitesh120(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Invalid memory allocation error with pg_recvlogical or with libPQ logical connection
Date: 2023-03-13 07:01:07
Message-ID: CAOEdJKFD361cNwJbXgEf9HOFH4+NdLaNmtMjw74VOTG_SSKESQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi all,

I have a use case in postgresql where I have inserted 1 row in a table with
3 columns as described below.
create table xyz (
id int not null primary key,
col1 bytea,
col2 text
);

The table has 1 row with approx 700 MB of data. The bytea column data in
the row has around 500MB of data while the text column has data of around
150MB approximately.
When I try to fetch the rows with the logical decoding using the
test_decoding plugin with libPQ connection, I get the below error -

ERROR: invalid memory alloc request size 1073741825

A similar error I see with pg_recvlogical tool.
pg_recvlogical: error: unexpected termination of replication stream: ERROR:

invalid memory alloc request size 1073741825
CONTEXT: slot "elob5121_a818598eea3b7a71", output plugin "test_decoding",
in
the change callback, associated LSN 1/BC5681E0
pg_recvlogical: disconnected; waiting 5 seconds to try again.

I have enabled the Server to debug log and I see a similar error -
2023-03-01 07:50:05.769 UTC [33486] DETAIL: There are no running
transactions.
2023-03-01 07:50:05.769 UTC [33486] STATEMENT: START_REPLICATION SLOT
"elob5121_a818598eea3b7a71" LOGICAL 1/9A163D88 ("include-timestamp",
"include-xids")
2023-03-01 07:50:08.122 UTC [33486] ERROR: invalid memory alloc request
size
1073741825

Please suggest if it is a known issue or limitation in postgresql backend
code. If so please point to the documentation link for the same. If there
is any workaround as well please update me.

Regards,
Jitesh Kumar

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-03-13 07:44:48 BUG #17836: Why does pg_dump need to add * to dump the full partition table structure
Previous Message David Adams 2023-03-13 05:19:47 Re: psql 14.7/15.2 report a bogus syntax error on function and procedure files that use BEGIN ATOMIC