X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2DB9152A84 for ; Sun, 13 Mar 2005 09:16:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67319-04 for ; Sun, 13 Mar 2005 09:15:52 +0000 (GMT) Received: from outmx001.isp.belgacom.be (outmx001.isp.belgacom.be [195.238.3.51]) by svr1.postgresql.org (Postfix) with ESMTP id 1A305566B3 for ; Sun, 13 Mar 2005 09:13:44 +0000 (GMT) Received: from outmx001.isp.belgacom.be (localhost [127.0.0.1]) by outmx001.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with ESMTP id j2D9Dib4000525 for ; Sun, 13 Mar 2005 10:13:44 +0100 (envelope-from ) Received: from [10.0.0.5] (100-237.242.81.adsl.skynet.be [81.242.237.100]) by outmx001.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with ESMTP id j2D9DdJG000495 for ; Sun, 13 Mar 2005 10:13:39 +0100 (envelope-from ) Mime-Version: 1.0 (Apple Message framework v619.2) In-Reply-To: <42320813.9040605@opencloud.com> References: <5bd6ef364cb5f644245035172a720b30@freeshell.org> <42320813.9040605@opencloud.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: patrick Subject: Re: Cannot Retrieve Binary Data Date: Sun, 13 Mar 2005 10:13:39 +0100 To: pgsql-jdbc@postgresql.org X-Mailer: Apple Mail (2.619.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.492 tagged_above=0 required=5 tests=DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200503/133 X-Sequence-Number: 12525 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 >