Re: Avoid incorrect allocation in buildIndexArray

Julien Rouhaud <rjuju123@gmail.com>

From: Julien Rouhaud <rjuju123@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Daniel Gustafsson <daniel@yesql.se>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-12T10:40:49Z
Lists: pgsql-hackers
Le sam. 12 sept. 2020 à 11:14, Michael Paquier <michael@paquier.xyz> a
écrit :

> On Fri, Sep 11, 2020 at 01:49:26PM +0200, Julien Rouhaud wrote:
> > On Fri, Sep 11, 2020 at 1:39 PM Daniel Gustafsson <daniel@yesql.se>
> wrote:
> >> Any reason not to bail early as per the attached?
> >
> > +1
>
> Makes sense to me.  This has also the advantage to cause a crash if
> there is an attempt to refer to those empty arrays in case of future
> refactoring, which is rather defensive.  By looking at
> findObjectByOid(), I can also see that we check for a negative number,
>

yes, I also checked that current code is already checking for that.

so I concur with Ranier's comment to check after that on top of 0.
> If there are no objections, I'll apply that on HEAD.


agreed.

>

Commits

  1. Avoid useless allocations for information of dumpable objects in pg_dump/