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 1wbB30-002LxC-04 for pgsql-bugs@arkaria.postgresql.org; Sun, 21 Jun 2026 05:48:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wbB1x-002Yg4-1q for pgsql-bugs@arkaria.postgresql.org; Sun, 21 Jun 2026 05:47:41 +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 1wbB1x-002YfW-0V for pgsql-bugs@lists.postgresql.org; Sun, 21 Jun 2026 05:47:41 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wbB1u-00000001Oks-3wdj for pgsql-bugs@lists.postgresql.org; Sun, 21 Jun 2026 05:47:39 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4908b92904fso45557095e9.0 for ; Sat, 20 Jun 2026 22:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1782020856; x=1782625656; 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=lNeMk3JEQ0dHJfQrz1lgaeHfSxphZA4AL2BKXezLhY8=; b=OfB81FdbMfdpjXvKRJR0NpHlvAgX5AeUUlfZ42QN+sChSitxrB/5mi/n+12GrCBCoZ q0KrhCIUdtRsu3vMG2dQrnr1uveg/TKpYPBCsuEvUNWiZLDQcwGD54bSn0DzQJWrXuKF pPBDyewHjDNWIfd9Kd/GgEE36CgZNjVMHqRgWh148/5Pp///GZWPuYvvyWyzn5nh7zFo gogR2cY6css3Y5eM27uks0SwYLvCQNVPkKcDRM8M7AqmnzSLT6R+oOQAmjmALnnWvvp9 kM26BjGEXllWba20Z/Si0CfhRoV8s/Cm2ZaRuieJ0VlKbAt2LuKElnIpNp8vZSAAoPvG 9nsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782020856; x=1782625656; 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=lNeMk3JEQ0dHJfQrz1lgaeHfSxphZA4AL2BKXezLhY8=; b=EY+5rxB6QM84wfe+IJcT6QpmNRlrUBi8c0FMm9lbv+w9eCsSSS/PmiOAb1VlLllcAl Dk1hohfYshCg/VBqjZt5ISniFb+kcAAMpwWBK3H1JpJbBgjBXf/7Q8+2bre7ndArpZsh o6nVa33DTPJP2EAcvAfFMVEc1nOyARg9/9c/K4MJpFlPHE4bq3Qtjyy3ydJGHFdeqV3k 4yT4yKV3WD+8vhMvoLFLElBQYuJI/rL9AbYQPThOXFtHZ5Omuwd5RkOVe+PJtf8dQbTZ uiw5EDfF8Knnfuh6uf7EdHTGKZ8E2Sr8sFmblHLrXWvLlVsPZBVpr5jixsHL6RzPHAIw ULWw== X-Forwarded-Encrypted: i=1; AFNElJ/2blXL5koQ629ug/+lJGpsSOgdFY9g950Lby7UV9HtTnMh93L990U4FQI2inCzq7x3Lg2C3CYGnFq7@lists.postgresql.org X-Gm-Message-State: AOJu0YzEM1hqHcblo2o5WmcmascOF0lgMIaj/X/l5Q6h8EfOPD9Hr1l6 WxxWyV2E0/DZRg6xv5E+x/y3fAvRNLSm0u6NPMy5eBfF7p6fs/sFmctliORWbnl/eLY= X-Gm-Gg: AfdE7cmvZaBeQjvnKt/ANkruhXrRyOze4XR2uP4e/VHHphJsoVMUW+/QJgXd+5shDlN D1ReKnmkftdlrBqkPW+2DJ99CWbth2B1t6AAJKy7aH0ByrOiLIr6ittnvXQx4bzJtyJl6n1RVjj iPZo4HQgeO8tPnuiYMynRpyYCVu8s6C5FOsf9ot5n6TkE1WwfloNyMPnK87qO6W/SlotKvK3WrR 79+/DARgzzcivY4M4S3xtzVHdr94NpgKe6ZBJC0dKjuvBXynVaor+IGGjzK9GFP7nHPEQ19wb3K yC7MYvnPklpqpN5HtSUkfjBSExXvxzeWyeWAOs6HYzh8wDnsq5l8EKT9lTOtxRn6zkT8flLpvmF ofn0WuC4tOh2+rd0hYZ/tcMBsIfDp2dQhJ7qYFnbuSlPqoiDizPJ2HfH0ahgw77/vBqxRc5yalM 2WRRWOk8tKEL1f7cm2Ncn9pEnMkcGgIyNRjY35ROP8buLN X-Received: by 2002:a05:600c:4e14:b0:490:d32b:39c3 with SMTP id 5b1f17b1804b1-49242326cf3mr122924265e9.6.1782020854989; Sat, 20 Jun 2026 22:47:34 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:b5dd:d75a:6339:d2c8:1d69]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4924944faa8sm105111255e9.13.2026.06.20.22.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jun 2026 22:47:34 -0700 (PDT) Message-ID: <5184088806e70ed5db7e83bd6540a016b3802c1d.camel@cybertec.at> 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 , Tom Lane Cc: Greg Sabino Mullane , pgsql-bugs@lists.postgresql.org Date: Sun, 21 Jun 2026 07:47:33 +0200 In-Reply-To: References: <19483-80de42dc4e62cfd6@postgresql.org> <104812.1780847519@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 Sat, 2026-06-20 at 23:53 +0200, I wrote: > I think that we need something like this fix, because a failing > upgrade is a bug. For the same reason I think that the fix > should be backpatched. >=20 > I looked at your patch and found that the query you added doesn't > cover the important case where the grantor is a non-existing role >=20 > I suggest a query like this one: [...] Further testing shows that changing this query isn't enough. There are three more places where pg_dump queries pg_init_privs (in getAggregates, getFuncs and dumpTable). So we'd have to use a similarly ugly query in all these places, which doesn't seem particularly attractive and introduces considerable code duplication. One approach I can think of is to have a macro SAFE_INITPRIVS that contains the ugly subquery and is used in all these places. The other idea is to do some post-processing of the aclitems found, but they are in string form and would need to get parsed again, which doesn't look attractive either. Yours, Laurenz Albe