Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Hüseyin Demir <huseyin(dot)d3r(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table
Date: 2026-06-22 17:23:38
Message-ID: 0d7531c192859057c6aad54c89a8d453376bd00c.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 2026-06-22 at 08:07 +0200, Hüseyin Demir wrote:
> > v4 applies the filter at all four sites where pg_dump queries pg_init_privs:
> > - getAggregates() — WHERE clause comparison
> > - getFuncs() — WHERE clause comparison
> > - getAdditionalACLs() — SELECT expression (object-level initprivs)
> > - PREPQUERY_GETCOLUMNACLS — SELECT expression (column-level initprivs,
> > objsubid != 0)
> >
> > 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-06-22 18:30:54 Re: BUG #19483: pg_upgrade fails with orphan records in pg_init_priv catalog table
Previous Message Tom Lane 2026-06-22 16:37:33 Re: BUG #19527: Double-Abort Crash in `ResOwnerReleaseOSSLCipher` via `encrypt_iv` with Oversized Input