pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: patrick <pch@freeshell.org>
To: pgsql-jdbc@postgresql.org
Subject: Re: Cannot Retrieve  Binary Data
Date: Sun, 13 Mar 2005 10:13:39 +0100
Message-ID: <f55fe783a729a522209c7390d92b2fec@freeshell.org> (raw)
In-Reply-To: <42320813.9040605@opencloud.com>
References: <5bd6ef364cb5f644245035172a720b30@freeshell.org>
	<42320813.9040605@opencloud.com>

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
>




view thread (5+ messages)  latest in thread

Message-ID: <f55fe783a729a522209c7390d92b2fec@freeshell.org>
Permalink:  ../f55fe783a729a522209c7390d92b2fec@freeshell.org/
Also on:    postgresql.org/message-id/f55fe783a729a522209c7390d92b2fec@freeshell.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pch@freeshell.org
  Subject: Re: Cannot Retrieve  Binary Data
  In-Reply-To: <f55fe783a729a522209c7390d92b2fec@freeshell.org>
  References: <5bd6ef364cb5f644245035172a720b30@freeshell.org> <42320813.9040605@opencloud.com> <f55fe783a729a522209c7390d92b2fec@freeshell.org>

* 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