Invalid memory allocation error with pg_recvlogical or with libPQ logical connection - Mailing list pgsql-bugs

From jitesh tiwari
Subject Invalid memory allocation error with pg_recvlogical or with libPQ logical connection
Date
Msg-id CAOEdJKFD361cNwJbXgEf9HOFH4+NdLaNmtMjw74VOTG_SSKESQ@mail.gmail.com
Whole thread Raw
Responses Re: Invalid memory allocation error with pg_recvlogical or with libPQ logical connection  (Arne Roland <A.Roland@index.de>)
List 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

pgsql-bugs by date:

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