Re: Cannot Retrieve Binary Data

From: patrick <pch(at)freeshell(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Cannot Retrieve Binary Data
Date: 2005-03-13 09:13:39
Message-ID: f55fe783a729a522209c7390d92b2fec@freeshell.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Exactly the same error:

ERROR: XX000: invalid memory alloc request size 2017394403
LOCATION: MemoryContextAlloc, mcxt.c:502

the table is declared as:
backup=# \d images;
Table "public.images"
Column | Type | Modifiers
---------+-------+-----------
imgname | text |
img | bytea |

and the query is (there's only one record)

backup=# SELECT img from images ;
ERROR: invalid memory alloc request size 2017394403

There's no way to stream a bytea ? how postgres support bytea with 1G
if is not possible to insert and select ?
FYI:
i tried the same Test with postgres 7.4.7 and earlier and is even worst
i was not able to insert.
The JDBC Driver Return Out_Of_Memory during the query execution

On 11 Mar 2005, at 22:05, Oliver Jowett wrote:

> patrick wrote:
>
>> i'm following the example at
>> http://www.postgresql.org/docs/7.4/interactive/jdbc-binary-data.html
>> trying to retrieve previous stored file (more than 600MB)
>
>> during the executeQuery() i got a the following exception
>> java.sql.SQLException: ERROR: invalid memory alloc request size
>> 2017394403
>
> What happens if you run an equivalent query via psql?
>
> I suspect what is happening is that you inserted the data earlier fine
> as JDBC sends it directly in binary form; however, when retrieving,
> the data asks for the text form, which expands the data by up to a
> factor of 5 (to >3GB for your file). The backend doesn't stream this
> data AFAIK, so it has to allocate space for the entire text
> representation. Then you hit a memory allocation sanity check in the
> backend, resulting in the error you see.
>
> -O
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-03-13 12:36:22 Re: Cannot Retrieve Binary Data
Previous Message Manohar Kaul 2005-03-13 00:59:21 help with driver info