Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gWTVY-0000q8-LM for pgsql-general@arkaria.postgresql.org; Mon, 10 Dec 2018 21:54:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gWTVX-0000ML-CV for pgsql-general@arkaria.postgresql.org; Mon, 10 Dec 2018 21: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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gWTVX-0000MD-0b for pgsql-general@lists.postgresql.org; Mon, 10 Dec 2018 21:54:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gWTVU-0004ld-Ap for pgsql-general@lists.postgresql.org; Mon, 10 Dec 2018 21:54:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wBALsPG6005055; Mon, 10 Dec 2018 16:54:25 -0500 From: Tom Lane To: Laurent FAILLIE cc: "pgsql-general@lists.postgresql.org" Subject: Re: pg_dump: ERROR: array size exceeds the maximum allowed (268435455) In-reply-to: <948369799.1762716.1544476526800@mail.yahoo.com> References: <948369799.1762716.1544476526800.ref@mail.yahoo.com> <948369799.1762716.1544476526800@mail.yahoo.com> Comments: In-reply-to Laurent FAILLIE message dated "Mon, 10 Dec 2018 21:15:26 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <5053.1544478865.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 10 Dec 2018 16:54:25 -0500 Message-ID: <5054.1544478865@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Laurent FAILLIE writes: > I'm trying to save a database from a dying disk on a Gentoo/Linux box. > Unfortunately, when I'm issuing a > $ pg_dumpall --clean > I got = > pg_dump: [programme d'archivage (db)] =C3=A9chec de la requ=C3=AAte : ER= ROR:=C2=A0 array size exceeds the maximum allowed (268435455) > pg_dump: [programme d'archivage (db)] la requ=C3=AAte =C3=A9tait : SELEC= T p.tableoid, p.oid, p.proname AS aggname, p.pronamespace AS aggnamespace,= p.pronargs, p.proargtypes, (SELECT rolname FROM pg_catalog.pg_roles WHERE= oid =3D p.proowner) AS rolname, (SELECT pg_catalog.array_agg(acl ORDER BY= row_n) FROM (SELECT acl, row_n FROM pg_catalog.unnest(coalesce(p.proacl,p= g_catalog.acldefault('f',p.proowner))) WITH ORDINALITY AS perm(acl,row_n) = WHERE NOT EXISTS ( SELECT 1 FROM pg_catalog.unnest(coalesce(pip.initprivs,= pg_catalog.acldefault('f',p.proowner))) AS init(init_acl) WHERE acl =3D in= it_acl)) as foo) AS aggacl, (SELECT pg_catalog.array_agg(acl ORDER BY row_= n) FROM (SELECT acl, row_n FROM pg_catalog.unnest(coalesce(pip.initprivs,p= g_catalog.acldefault('f',p.proowner))) WITH ORDINALITY AS initp(acl,row_n)= WHERE NOT EXISTS ( SELECT 1 FROM pg_catalog.unnest(coalesce(p.proacl,pg_c= atalog.acldefault('f',p.proowner))) AS permp(orig_acl) WHERE acl =3D orig_= acl)) as foo) AS raggacl, NULL AS initaggacl, NULL AS initraggacl FROM pg_= proc p LEFT JOIN pg_init_privs pip ON (p.oid =3D pip.objoid AND pip.classo= id =3D 'pg_proc'::regclass AND pip.objsubid =3D 0) WHERE p.proisagg AND (p= .pronamespace !=3D (SELECT oid FROM pg_namespace WHERE nspname =3D 'pg_cat= alog') OR p.proacl IS DISTINCT FROM pip.initprivs) > pg_dumpall : =C3=A9chec de pg_dump sur la base de donn=C3=A9es =C2=AB po= stgres =C2=BB, quitte This looks like a manifestation of data corruption in the system catalogs, specifically a broken proacl field in a pg_proc row for an aggregate function. Now typically, all those fields would just be null, so you might be able to recover by looking for such rows and setting their proacl fields back to null. At worst, if you'd actually granted or revoked any privileges on aggregates, you'd lose that ... but in a data recovery situation, that's probably not your worst problem. Try select proname, proacl from pg_proc where proisagg and proacl is not null; and see what you get. It's likely that the affected row(s) have more problems than this, in which case deleting them altogether might be your best bet. regards, tom lane