Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jld4I-0002U7-Q7 for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Jun 2020 18:45:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jld4H-0006Kf-Ba for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Jun 2020 18:45:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jld4H-0006KY-5O for pgsql-bugs@lists.postgresql.org; Wed, 17 Jun 2020 18:45:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jld45-0005Di-JN for pgsql-bugs@lists.postgresql.org; Wed, 17 Jun 2020 18:45:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05HIjZ711453989; Wed, 17 Jun 2020 14:45:35 -0400 From: Tom Lane To: "Thompson, Shon" cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: Invalid memory alloc querying field type bytea In-reply-to: <1EE72409308D54419CC1915B28D0FC2A5290F1E0@EXCPRDMS02.mainegeneral.org> References: <1EE72409308D54419CC1915B28D0FC2A5290F1E0@EXCPRDMS02.mainegeneral.org> Comments: In-reply-to "Thompson, Shon" message dated "Wed, 17 Jun 2020 18:24:53 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1453987.1592419535.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 17 Jun 2020 14:45:35 -0400 Message-ID: <1453988.1592419535@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Thompson, Shon" writes: > I'm getting errors when I query a table that uses data type bytea. I ca= n query the table if I don't include the field for data type bytea. Here = are the two error messages I get. The first error is one generated from v= isual studio: > "ERROR: XX000: invalid memory alloc request size 1294068297" Looks like a corrupt-data problem. I doubt it's directly the fault of bytea; any variable-length field would have given a similar type of error, because what this seems to be is a damaged field length word. Do you see any clearly bogus data in other columns of the table? That might help isolate which row(s) have gotten damaged. It seems somewhat unlikely that only the bytea field header would be clobbered and not any adjacent data. The questions you should be asking yourself include whether your PG version is up-to-date and whether the storage stack is reliable. regards, tom lane