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 1wbXok-002eUk-0j for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2026 06:07:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wbXoh-004gX6-2g for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2026 06:07:31 +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 1wbXoh-004gWx-1g for pgsql-bugs@lists.postgresql.org; Mon, 22 Jun 2026 06:07:31 +0000 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wbXoe-00000001i6e-4Bou for pgsql-bugs@lists.postgresql.org; Mon, 22 Jun 2026 06:07:30 +0000 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-7e93cd4e64bso1716704a34.2 for ; Sun, 21 Jun 2026 23:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782108447; cv=none; d=google.com; s=arc-20240605; b=gX3nGISCmuMHTgp6m440AljKTfSZA0zKvcpJhJCFvozhS8BckvGxpw8tE2FZPsUuQD A4U2yKV2+NZMdoqZ36oR3LjYNK5TEkn9R5V7Lvxbigae7KXtWRErfCBB9rw4Z6hkt/35 GtLCidd1gBnoRb+tZyh9LXyWFm1ocJVH6lVQrh3fqg2B4ubn8XZ2LEXPW8ZXcEoXbv40 k1r+O9tO18gAbRN1UFhLDee4RLMNYNHP+yVHvjpWDohBgViucmOPlb4VPYsckzLNQ/aY 5t168uTQy1VhSbhE/vmnOb5s1HECL1zCkdpF29UCtLlDsG1mctbqBPKBahq2RR9xncOF txww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=RxuFg4SzoHh9FET8QxWK4oMdrnARVozinVn5q3QRaYg=; fh=1of6UbMi/OQ2Lv15uxoHaIB0vtLAVBrPInHaukKXdTk=; b=JM3fLd/mqOUoy3gaf+N+bs397EcONFaGbIOfbekrjebwa+2YGB1JvLzY/OWeqUeOYr mI4CpbCtVavbY/g5q//CORpaB+yYq1R3qkcZQsYyEL6xZ+Ffhs2Fbe+2stToWx8uCSCl 2NLIU6QTuEBTf9hr72k3aH52fdzLOWDbG3FhMwzOqBQRcpkOK8A24YQE+e/io+Ltybjc AZbcmpEEsft2XeNOEKee8x/WIF/sjXIHt6txyhxFVj4+N4AsgEaV6nH4q2/tI2jgJPHz +F5znrYIg5JA4dOkLVY/uABs0ZeTgALpxnN36t8lufK1zFWIH4uUBMkMJtOyIBjHZkkG Om/g==; 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=1782108447; x=1782713247; 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=RxuFg4SzoHh9FET8QxWK4oMdrnARVozinVn5q3QRaYg=; b=CosXbF+3Kkik2oDeuZD7S7huxVz8vNQZqse68Qy7MAaO7y7kRv4imhsMkCRNzJBfds cDahsSOqZ4VESi+TaB8y4PlF/x+Vbr81WUgAO2jKjVCPw9u1LTBYQC1kcfe3y0jtBY/P +qi3WIVYCL+XFemCLTiisVU8LxUuxLgMxEYG4MNW1KaFyQwwWCXHMhOG2MnKnFHPzix2 im6rxjFihAsFFAi2qLZPtfR3gpYFIp9qapU9jWs8vZv4Rk2miFAZ4xiG+oQqpr0E0fJ1 FCQLRmjHMZJA+uLyF0h1+srabDTeyTI6A8OJeXad5hJzGb5DfekKc4NAUQkofWP/8xcZ wNow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782108447; x=1782713247; 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=RxuFg4SzoHh9FET8QxWK4oMdrnARVozinVn5q3QRaYg=; b=a5SVAYR82d6zkwIRvKhrV/KXo/FTssllLmJnKCaZtq1TElFy9vjE76h7QUVhMLsvtQ HsG96TZSs8/OApUgIOuxiQOVRT8JbmT4k/ybHaLKxIfGHMUakp90wgonilYyx8GyvId3 IjQWtZJxQug4pfuKI/A4AXlg1vp2Hq3JRCaXKL0XDNL09GjK6cZlkr2oB7X4Obkq0z5O UrpvY7OswhoZw7biJVUeMM3+WgHr+s8am1qIQLs6/cyh4klkdtDINaz/d0M7fwvAVN3T PujOQeCDVYZDbALhu2RsMQFsfdLwdzcxAjOPOiWU4JT3E6Sg0W/d+LQPAbu/WcLVBOO2 zIqQ== X-Forwarded-Encrypted: i=1; AFNElJ/AFHRmf/MsWMhO7sDJraH1wKhTIeY/luZCepVwPzYt47SdpiRUDOsSROo9M0ciywtEefKlghhQBTjz@lists.postgresql.org X-Gm-Message-State: AOJu0YzLtuuh5NdmmUkYnRZtpFTnL6z/R1OBfchTU7jeObDYQ3bOegQt 1UD/9l++2b/JrD+ntXL8/PXRBLjAm4qDnEB5OYq84P28febuMb/grpSJ3JvsG8MySxt7noHB5+O 3qJ42CwpVqVPtQj1rXuPRtmVP1TQ+E/c= X-Gm-Gg: AfdE7ckvl/U4khhzpaevDow5bx1AiY00cf96ZQ1ugfyjvCcpdsr+RSZr3uZOgBRC2vk EOi+CCopsOevaP1T6W7D0m+wSoNZUOWtpb+IzSGwQJI4LOizPqiNXWc1BrrqLTnL81wxveMEsHY Z2RXl4SXhEld5JxBK7mfFIu1G1R5KFk816xSodTMAGgz+BCqkRh6lFQrimOnJQhj4RszngpsDfg KhNlE7PcJtD9u/YDzWocqv/nGTwUUyxqfvcf187l4mztlcT1Pis72wEWMd4UaW+WORCTKk8xamP C1EJGLoSWzG7Lrgo5oPq2Y03bENIQ6yUI4XwgCfWPhqt3b6Zq/i90aW6psn1llUWKgsZKR4M7W+ 8/BBT0e1HOaFkaFE= X-Received: by 2002:a05:6808:3205:b0:486:4bd0:9a1c with SMTP id 5614622812f47-489b1cdf3ddmr10301092b6e.43.1782108446826; Sun, 21 Jun 2026 23:07:26 -0700 (PDT) MIME-Version: 1.0 References: <19483-80de42dc4e62cfd6@postgresql.org> <104812.1780847519@sss.pgh.pa.us> <5184088806e70ed5db7e83bd6540a016b3802c1d.camel@cybertec.at> In-Reply-To: From: =?UTF-8?Q?H=C3=BCseyin_Demir?= Date: Mon, 22 Jun 2026 08:07:16 +0200 X-Gm-Features: AVVi8Cej3J_eGNN7_eZ1yX_4-5W9MPHcm23WZOcLLR9Ccn6dO5FShexZy69ca7s Message-ID: Subject: Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table To: Laurenz Albe Cc: Tom Lane , 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 > > > 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. > > > v4 applies the filter at all four sites where pg_dump queries pg_init_pri= vs: > - getAggregates() =E2=80=94 WHERE clause comparison > - getFuncs() =E2=80=94 WHERE clause comparison > - getAdditionalACLs() =E2=80=94 SELECT expression (object-level initprivs= ) > - PREPQUERY_GETCOLUMNACLS =E2=80=94 SELECT expression (column-level initp= rivs, > objsubid !=3D 0) > > Secondly to avoid duplicating the multi-line subquery at every call > site, I introduced a SAFE_INITPRIVS(col) macro. One question from my side: can't we use function instead of macro ? Would it be more accurate for future readers ? Wanted to ask your opinion besides the v4 patch. Regards, Demir.