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 1wchZq-003Ybn-22 for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Jun 2026 10:44:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wchZp-00535x-0c for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Jun 2026 10:44:57 +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 1wchZo-00535p-2z for pgsql-bugs@lists.postgresql.org; Thu, 25 Jun 2026 10:44:56 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wchZn-00000000AlX-19wd for pgsql-bugs@lists.postgresql.org; Thu, 25 Jun 2026 10:44:56 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-c0bce8840b6so315110066b.2 for ; Thu, 25 Jun 2026 03:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782384292; cv=none; d=google.com; s=arc-20260327; b=FUXiNcPyCxspfYyZOKVhwE0Z9pWqjf0vAKeirw1n0caeqxHzuyxZzHYmrn571Yeq6p k9uyYMVB7A3YU0gUpV1HCizABG03+KlE1vkVg5YDv62AI7dBxdUo6hEol630DEb23ryc LcvrvWvwZptEGGOiwGLlY/PH46hUNeUs0WcfU0EjhpuRISCxpDgx2GlO2uvqeSpeBCEg vq8JjwyrhzWr2EB4PfIr7IZgU3wdMk6KIu18XzyVZnraK6ZzMm6OdnI0exCdM+XhphlE gEsKaLE02IAP1JMy08UvtCJEC39dOR/8xPthPsStKEJM+ASvwjDrgdGJh1P4O8BgUAqo B+gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dct8hnL5eKrJdmH96cs8dztP1mn+qqjAwg/y6AjPjBU=; fh=SZxUw6vrqTILJL8il9TpwoRyPSOTYkp7Qo9/nEd8qPw=; b=IReOXnQUWOJa+nqRSo4hDuEBC8BWyNO8kPunTPUAzStzXWNY+TSCunaC//xLWPYUGb vgCOh8CcOYM/VoNdW39jdQbbYaSmXYN23Bi+HogHO3PE7rpKBgPv+70FcaOsHr2sbm4P LEtVkMmRbFwxNpZ5TQ8zbR5H1fM5s7a96j4btQ/NMG2F0W64/aUr91Yb9x99cV6WAQvL xsZUj5RAqcISK6WCrmCYRFywn+bADG5XWWy0jD0e8UwZetOXooKW76QMzcagHThCloQJ VJK2Y6QspNPUJzqwZDKRjZPzvTxdanQWalaCBHO3O/F5tbV2pMYHOvNkfOE1boPx4PqX Wgtg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782384292; x=1782989092; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dct8hnL5eKrJdmH96cs8dztP1mn+qqjAwg/y6AjPjBU=; b=nVbUn84u2yZQvvhOZtIJ33OMtiuDt6peTttOZ8fVYKBnBkzLhqbDnJNq/kajAwhkXK sExDbBvZPpgSPIS9xqtLVDZUk8bOMdqaI471/rpTLPuGHgff85kDOi5tTk6bMSPg1O2P AzRQmvfeNrEjY4J9JmPfHEQpoDBNoclVup1++suVc5bv1GJDXmZPWhASlRlcW7zRnNZt uT7pAuoOXQzgziRqczA0W301V5tFfb6uSbH7f+Rgx0zvXYY8PvsHqtZ45fjQh4+2yuUC cPcPScphgQM036JKJSMgxU4qcIkwdKWgdmuXVrsQNxtdNPLxe+FyGSXfsoL1/lBRiLSc KU9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782384292; x=1782989092; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dct8hnL5eKrJdmH96cs8dztP1mn+qqjAwg/y6AjPjBU=; b=bRGuSw9956OCSDKizz02tR+oISwXUg4VOiH8HGMkIi7BEB3W5K6Miy+1q9znjSzuVP 59SNthjT59DfOiquuY7iPnLT4s/+Vmr6dlJ5VL3VN4Bq2IXgEM91xi67pI/uV3k1oqlA NRGp2ZdJ9J+AFHJ8wjXQ9rnLti1ByuEQ8vdAuydBjhls75ap3ck76UDj7pCy9T3Re6XR Bqm54WWx+6tyfrnHt9blQO99/XOjX4jYRS5ysndK5wvjQJuKvU3pLd9T5kA7AE9TRADz IGmWcm/ITuFBNjToO31W8g1FgKo8drXjmfIa0WxOyAl0W93ZiK50o/UAi/16x3+2BunP Y5Gg== X-Forwarded-Encrypted: i=1; AHgh+RrhwcLa2WAn2x+hQRgutVz65PjQVkrkqMVmF7vi6J7TA/6d2M+ugZ8/xi/IuxDuzrtfGP6F7E8DTeDE@lists.postgresql.org X-Gm-Message-State: AOJu0YxFrWTIfbiIrGw+CaPxi3Fj0KcZbTgFHXswM38TOMAubRdICe27 HXCnSBCIJu/Z8YR/r+W4vLa6FNmQpC5HlgXG3F0tSruH4E6zzyBXEnMfKnRV+lMww+iGgR7WoRe 9e/SfX0G7J2/BkZOb7Wk06eB6BbOAyJo= X-Gm-Gg: AfdE7cn3GKCcnbKCKU55VaJonveIqhkztVNd1I+Z9EIvUvcLOMFrXX0u/z5GSQ6nYYY l8B9cHp3kVsyHlJM1brRIuRvvNWjnm7imQVQq49SbvDpvQ4A2ApvSXN8R1CzbACMaZAdH+VoMYw 3UmG16EXDxSGM+tETPOOx/v065jQ0A6n3OsRy/e8mjyqZX/VlNO1k8ivTrPzbcIebQtr66Q5I1U 1aQZk5ljnMnqyTvqO8x9CIbNU9AnGkBhISd+W2sVYF1yJRxZejgwR0Fd2Lr50Wc+7aRI1kkWte1 M4z87gfeY1v7avYS+u7Iz1+BOhR7Uw8HmyZZiLc= X-Received: by 2002:a17:907:9711:b0:c11:40ff:5f79 with SMTP id a640c23a62f3a-c1205eef009mr115329566b.37.1782384291837; Thu, 25 Jun 2026 03:44:51 -0700 (PDT) MIME-Version: 1.0 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> <1030965.1782313078@sss.pgh.pa.us> In-Reply-To: From: Rui Zhao Date: Thu, 25 Jun 2026 18:44:38 +0800 X-Gm-Features: AVVi8CeZWtGLJ0ird1Io3zHAXUQEyooptytg7itpTw14l1llHV46jKZXJirjwZ0 Message-ID: Subject: Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table To: =?UTF-8?Q?H=C3=BCseyin_Demir?= Cc: Tom Lane , Laurenz Albe , Greg Sabino Mullane , pgsql-bugs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi H=C3=BCseyin, I reviewed and tested v6. The filtering logic is correct and applied in the right place: doing it in the source queries (getAdditionalACLs and the column-level ACL query) means the dangling entries never reach the binary-upgrade "SET SESSION AUTHORIZATION " path, which is where the upgrade actually broke. Using pg_roles instead of pg_authid for the existence check is also right for non-superuser pg_dump. With the test running, all of its assertions pass. Two things on the test: 1. The TAP test doesn't run for me at all -- it dies in setup with "role \"rui\" does not exist". The cause is that the aclitem literals are built by concatenating current_user unquoted, e.g. ARRAY[('ghost_grantee=3DX/' || current_user)::aclitem] My bootstrap superuser is "rui.zhao", so this becomes 'ghost_grantee=3DX/rui.zhao', and aclitemin parses the grantor only up t= o the dot: =3D# SELECT ('g=3DX/' || 'a.b')::aclitem; ERROR: role "a" does not exist So the test fails before any assertion runs on any cluster whose superuser name needs quoting (a dot, uppercase, etc.). Wrapping it as quote_ident(current_user) in the four aclitem literals fixes it (the test then passes 12/12 here). A bit ironic given the patch is about handling odd role names. 2. The PUBLIC case (grantee =3D 0) isn't covered. The "ace.grantee <> 0" branch is what keeps PUBLIC grants from being filtered, but there's no test for either direction: a valid PUBLIC grant ("=3Dr/validgrantor") being kept, or a PUBLIC grant whose grantor is dangling ("=3Dr/ghost") being dropped. Worth a case or two. Thanks, Rui