[HACKERS] [bug-fix] Cannot select big bytea values (~600MB) - Mailing list pgsql-hackers

From Anna Akenteva
Subject [HACKERS] [bug-fix] Cannot select big bytea values (~600MB)
Date
Msg-id c8bdf802d41ec37003ec3b726db79428@postgrespro.ru
Whole thread Raw
Responses Re: [HACKERS] [bug-fix] Cannot select big bytea values (~600MB)
List pgsql-hackers
Hello!

If I create a big bytea value and try to select it from a table, I get 
an error, something like: "ERROR:  invalid memory alloc request size 
...".

So basically we can insert data into a table but then we can't even work 
with it. Sounds like a bug. Attaching a patch that fixes it (applies to 
2a41507dab0f293ff241fe8ae326065998668af8).

And as it seems like quite a serious issue, would it be possible to 
backport a fix for it to earlier versions?




HOW TO RECREATE:
1) generate some random data (in this case, 600 MB):
dd if=/dev/urandom of=rand.dat bs=1M count=600

2) postgres=# select lo_import('/PATH/TO/rand.dat');
  lo_import
-----------
      16397 [USE THIS ID FOR THE NEXT STEP]
(1 row)

3) postgres=# create table big_data as select (string_agg(data,'')) as 
data from pg_largeobject where loid =16397;
SELECT 1

4) postgres=# select * from big_data;
ERROR:  invalid memory alloc request size 1468006403



-- 
Anna Akenteva
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: autovacuum: change priority of the vacuumed tables
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] [bug-fix] Cannot select big bytea values (~600MB)