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 1wbiN9-002mku-1Z for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2026 17:23:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wbiN6-007UVC-36 for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2026 17:23:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wbiN6-007UV4-2B for pgsql-bugs@lists.postgresql.org; Mon, 22 Jun 2026 17:23:44 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wbiN4-00000001mye-0r24 for pgsql-bugs@lists.postgresql.org; Mon, 22 Jun 2026 17:23:44 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-49249072f03so12566025e9.0 for ; Mon, 22 Jun 2026 10:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1782149020; x=1782753820; 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=grrxfkfOLmXq7tLiZ2A4jHKQltJXRg3eeJh/iYmzVJk=; b=KLcyU9im4fBGPIZcPayIqtqo6F+VDOOjiit2HH89KhRDv4h5PoBPegM5ZI7ms8rLLc jbSs2LIo7oaKXzS3pGfCjPV8GUGaehU2UkUC0dqLpfa9MWqFxuB6l2FIMKGYsuEwH4cx CYBkr3N4pZ71XnyO/6Bne/bW4oZEGWdbJP8+l2vcVoAUUonupWS3zCA5Ai98Fu3XxmXq F3T9BiQDW4L9vt/UJ/HR4E8qPis2s7+E9swSYWGTHoOgWbo8626SWpt+MC3T9F1/TuAw 7Ofa6CGAmzXpm4DwsHy0sR+joz9qbMeWPJurofbNT868Z1+1pggAWqbdxbrutlFgNfor VEQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782149020; x=1782753820; 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=grrxfkfOLmXq7tLiZ2A4jHKQltJXRg3eeJh/iYmzVJk=; b=nHRI6LXllb+OzxrmD2G7FvTlcZUchN4pKuu9MV95X/pVq/EK7+OE8tlrgJ1pGI/xO9 p/7XEL1m8EDcuH4072Fi8Y0VZ2ln5iBOanxE1kxgK02siqdlSlTCATkRhIVK8TcUKWfb HBGWMmIpGP+H41yKCPgKjwa5z0pWcYooppW5vHHNs9PBBbL3XHQOSYYj4ukFm8Esd/rm OXSC76P1s7lSuhldh3WIbVwgEDmhOybgPtXjxBAu+orBiulj+KyKaPCamm8s9RqStlbc KXuxsN5kiQb7CiMbMbiQsc5765WkHbF13r+GysmueHPBk/FgSHg/zh4XpuDxCdmpb9KK Rw8A== X-Forwarded-Encrypted: i=1; AFNElJ/hSv+Oyz9LYbbEI6m7CwADFIoAflg42m/uszfv3yqU1zmYSIljne6BJbxKblwpdPbmTXKl29WFCVKR@lists.postgresql.org X-Gm-Message-State: AOJu0Yxo90/6EDHoKqHmYvtVHG4OHQ6f/mWdCWBH3HonDMQLSvzZ4JPa taHQ0vS9rpJ9Je6/AhqYLOpe5xV3PgSRawhjh2VSFVhDqIY8LIeASLjJJ500al4DRfs= X-Gm-Gg: AfdE7cn+bsr5x70Z5sH5Cy3RsLxTM7VKrbeSVVzdmHPgVdZViQMmG3oxM8wEGQBo9v5 Aus4bXHyyhTdAwKbfmmyPzZDHa8BN2EExH7NkTdxceaGyKCrAZ12APLbj80mYQi568nn4V1Ds5B zEWJbIcn9Z0DMoK4ipINVqoskkmA/TDavivZhWxhPsm2ZGMWKwOpAgeVNnmC2pLtc1PTMJ7ssqU 84/CDIQPeK460x70N/VNC9XKWZCuOGy0dHlOtm5YZhDm4UmLOTBQx8RcAlpJOn7AOU43/ypjR5h upNEKJuvSFr2rSWXwT6wcb8AKXW/m8xBDZwc5CBqIDMhlZZ5r3FHLpj7Eh3h9f+Dfbd2sUNOl7V jJfMfOlnWSaDNT4xD9pOxqdMDgQdluqdsxVzTrXOtt99paqAdoeWFTQJXTCVuWRYVgU3iMefMsg eXKIDBJ6LqYMIKzKy4H7oHQV7aYB/vfQcQGLKOF8fNbyI= X-Received: by 2002:a05:600c:8b42:b0:490:b724:5085 with SMTP id 5b1f17b1804b1-4923f5944eemr305980405e9.33.1782149020230; Mon, 22 Jun 2026 10:23:40 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:260:1d74:9612:6aa7:ce18:6762]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4923fcdd08esm191553745e9.0.2026.06.22.10.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2026 10:23:39 -0700 (PDT) Message-ID: <0d7531c192859057c6aad54c89a8d453376bd00c.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 Cc: Tom Lane , Greg Sabino Mullane , pgsql-bugs@lists.postgresql.org Date: Mon, 22 Jun 2026 19:23:38 +0200 In-Reply-To: References: <19483-80de42dc4e62cfd6@postgresql.org> <104812.1780847519@sss.pgh.pa.us> <5184088806e70ed5db7e83bd6540a016b3802c1d.camel@cybertec.at> 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 Mon, 2026-06-22 at 08:07 +0200, H=C3=BCseyin Demir wrote: > > v4 applies the filter at all four sites where pg_dump queries pg_init_p= rivs: > > - getAggregates() =E2=80=94 WHERE clause comparison > > - getFuncs() =E2=80=94 WHERE clause comparison > > - getAdditionalACLs() =E2=80=94 SELECT expression (object-level initpri= vs) > > - PREPQUERY_GETCOLUMNACLS =E2=80=94 SELECT expression (column-level ini= tprivs, > > objsubid !=3D 0) > >=20 > > Secondly to avoid duplicating the multi-line subquery at every call > > site, I introduced a SAFE_INITPRIVS(col) macro. Great, that's just what I had in mind. > One question from my side: can't we use function instead of macro ? > Would it be more accurate for future readers ? That would work too, but if you do it in C rather than with the preprocessor, you have to deal with string manipulation, which will makes the patch more complicated. I think it is better the way it is now. I'll mark the patch "ready for committer". Since there have been very few reports of this problem, the question remains if we need this patch at all, or of it should be backpatched. My opinion is that it should; every upgrade or restore failure is one too many. Yours, Laurenz Albe