Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wcyxX-003ndd-2j for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Jun 2026 05:18:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wcyxW-008slI-1S for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Jun 2026 05:18:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wcyxW-008slA-0R for pgsql-bugs@lists.postgresql.org; Fri, 26 Jun 2026 05:18:34 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wcyxU-00000000I3v-06TK for pgsql-bugs@lists.postgresql.org; Fri, 26 Jun 2026 05:18:32 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-49222b6e871so3012635e9.3 for ; Thu, 25 Jun 2026 22:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1782451110; x=1783055910; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=0ICFpXSodGoTrPTs7jOiTjPizzeewMS5QkD215s8CKU=; b=YfFP1CnT5x8Y5eY+ndXjy7nUOwqvhyyyNZofEjLRQS4hHXkl8dIWdGfLjFU9TSmH+L wEKYv3Lw1kqtjiuo5VcXCxhROhGS3fUkN+dJ3YXsXgeVpV++8EuGt1icD46ntA2DzgiZ LhBYd898/k11MSwCTzCNO+x/p8Zik6NUxKetjH2ZgrLREQ7lbuZ6dG0HDFj9SpXGdVqf rTshsuhrxL2F72TubzZoJ15UXEXV80vCYK1I7ClRP0nDQbIkVAy82wpv5x4j2xC9veHx l1EBLStvU7VkTgD16xXMx/d2ydcA5msomMIE+joL/Ma1C8j6qkAEf3Ueae5c9FuXcdU0 4xxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782451110; x=1783055910; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0ICFpXSodGoTrPTs7jOiTjPizzeewMS5QkD215s8CKU=; b=JFCFL9+hQfAVTOmjwKKxD3UkU1Hra0d57OsnFJxLz2Bieb7Jjkkvcsh6aJpp7UPyhf KELBJQnaZjk5Jah8/5I9OyrEuRJgqWJsPVGd/BOmcd03iJ6v3hUy9AAbiZYKgoo/K/cs Vtu9Ds6kipQ9A9UrRQUL+NzKRJnndr4LMGevLPLoyWbwmm83zpiY6OGTqXGF7kqHsHH0 hgeWB3190kTbgeSqgx6wsFqF1x4XUcb0He78koFNWtvejE16y12MUrvopTMPBy4ZLCpS jrKwYFymTRUARKWN9utNwKLcan8CjRZwmv0vqDhcMQ0gEoYPnfASVTJglYKUkotroR9Z 1rSw== X-Forwarded-Encrypted: i=1; AFNElJ89CQ2f5x/wOKVXGoR4cyVLpHew/9f5VxoQO+t8isp4gEgccruNGpCx6Me7sgQePvRRA6rh0VsmXqxR@lists.postgresql.org X-Gm-Message-State: AOJu0YyyLdedR9S9nuAwcQ2RSs4EY6P2pbrww+bckIgwCQez2AziRcay 0PrApn9WEjso8LuFDr6cT0/r6YXfGYDcc22m8vlD+8yFdfslbKE+ot0wL1A8/wAJbfw= X-Gm-Gg: AfdE7ckY0RnFsO7SZhzOyTS/DliBzBHSqFZCapQ/FQQkWEgoLw+0MWvS3olizTxgK8h DKi+pNjRy6lP/VYSgeJ5MayhL+NhGoNMNzy6AzbqiqED+KFxsyMr4OYiCyEkhcu08rz5u0t2zF1 3U/NKfEYXj+0upM94HfQQ8ip4omOcOf8nRUaFByFuNdfjCrk7HQUTW/qc8WGBP7c1UN7P129PYa xpI7Z8Gw7W3SlLvB9wavuru3nzez1mt1iU6yD0DMI86Bh7j211DMHnVlKoNu5lCpIcRvUBIN9L9 gVqvVRnAUa1n8xe7DavE0hX2HC+MyV2OxXi7bnpVIIOvxrf3ybAnJMK4j0yESYSNFiaMkzrQTiY LWLij01ONV/8uQcU4gm+UY8PclGunw3Dhl/fkiI9OBFPqHRzGBwim9HgTmfXrFQwpupY1PYJq59 finQue/19g11O0xAY5Pme4DqF5SxYae2YRPgqvtDl/ X-Received: by 2002:a05:600c:c0c5:b0:492:5e12:33fe with SMTP id 5b1f17b1804b1-4926689fb07mr66379775e9.28.1782451110111; Thu, 25 Jun 2026 22:18:30 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([46.140.155.29]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-46c2279b7d7sm20295640f8f.31.2026.06.25.22.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2026 22:18:29 -0700 (PDT) Message-ID: Subject: Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table From: Laurenz Albe To: =?ISO-8859-1?Q?H=FCseyin?= Demir Cc: Tom Lane , Greg Sabino Mullane , pgsql-bugs@lists.postgresql.org Date: Fri, 26 Jun 2026 07:18:28 +0200 In-Reply-To: References: <19483-80de42dc4e62cfd6@postgresql.org> <104812.1780847519@sss.pgh.pa.us> <5184088806e70ed5db7e83bd6540a016b3802c1d.camel@cybertec.at> <0d7531c192859057c6aad54c89a8d453376bd00c.camel@cybertec.at> <592839.1782153054@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2026-06-24 at 14:19 +0200, H=C3=BCseyin Demir wrote: >=20 > This v6 patch adds a SAFE_INITPRIVS macro that filters aclitem[] > arrays server-side by checking that each entry's grantor and grantee > OID still exists in pg_roles. It is applied in exactly two queries: >=20 > 1. getAdditionalACLs() -- the one-time fetch of pg_init_privs at startup > 2. dumpTable() column ACL prepared statement -- per-table column initpriv= s No, that's not good. If you are running the complicated subquery for every table dumped, you are re-introducing the performance regression from the v4 patch that Tom justly complained about. On the other hand, I agree with you that Tom's idea to make this fix depend on a minor update of the source server that fixes the string representation of aclitems is not so great. Few people undergo the hassle of applying the latest minor update to a server they are about to update (and I am not even speaking about the users who keep running on the 14.3 they went into production with). Yes, the problem that the present patch is trying to address is a rare one, and we should keep the maintenance and performance burden incurred moderate. But what good is a fix that won't work for a good percentage of the affected cases, even if they are few? Here is my latest idea (hold your noses): Instead of having pg_dump query "FROM pg_catalog.pg_init_privs pip", how about writing "(FROM (VALUES (...), (...), ...) AS pip", where the VALUES clause is composed from a query against pg_init_privs run once at the beginning of pg_dump that excludes the bad entries? Critizism I forsee is that a) this is ugly and b) very long VALUES statements might also constitute a performance regression. However, I have yet to see an extension that produces a hundred initial privilege entries. Yours, Laurenz Albe