Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJj58-0002Wv-7n for pgsql-general@arkaria.postgresql.org; Mon, 05 Nov 2018 17:54:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gJj55-0005Dl-Qt for pgsql-general@arkaria.postgresql.org; Mon, 05 Nov 2018 17:54:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJj55-0005CI-EE for pgsql-general@lists.postgresql.org; Mon, 05 Nov 2018 17:54:31 +0000 Received: from mail.verite.pro ([185.16.44.216]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJj51-0007vc-UZ for pgsql-general@postgresql.org; Mon, 05 Nov 2018 17:54:30 +0000 Received: from genius-map.net (verite.pro [195.154.189.246]) by mail.verite.pro (Postfix) with ESMTP id 797128C00A5; Mon, 5 Nov 2018 18:49:56 +0100 (CET) Received: by genius-map.net (Postfix, from userid 1001) id 21F6338A2B74; Mon, 5 Nov 2018 18:54:25 +0100 (CET) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Trouble Upgrading Postgres From: "Daniel Verite" To: "Charles Martin" Cc: "Adrian Klaver" ,"Tom Lane" ,"pgsql-general" In-Reply-To: Date: Mon, 05 Nov 2018 18:54:21 +0100 Message-Id: X-Mailer: Manitou v1.7.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Charles Martin wrote: > SELECT max(length(docfilecontents::text)) FROM docfile; > and after a very long time, got: > ERROR: invalid memory alloc request size 1636085512 SQL state: XX000 It would mean that at least one row has a "docfilecontents" close to 0.5GB in size. Or that the size fields in certain rows are corrupted, although that's less plausible if you have no reason to suspect hardware errors. Does the following query work: SELECT max(octet_length(docfilecontents)) FROM docfile; or maybe a histogram by size in hundred of megabytes: SELECT octet_length(docfilecontents)/(1024*1024*100), count(*) FROM docfile GROUP BY octet_length(docfilecontents)/(1024*1024*100); Note that the error message above does not say that there's not enough free memory, it says that it won't even try to allocate that much, because 1636085512 is over the "varlena limit" of 1GB. AFAICS I'm afraid that this table as it is now cannot be exported by pg_dump, even if you had enough free memory, because any individual row in COPY cannot exceed 1GB in text format. Best regards, --=20 Daniel V=E9rit=E9 PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite