Re: pg_basebackup fails on databases with high OIDs

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup fails on databases with high OIDs
Date: 2020-01-13 13:07:06
Message-ID: CAOBaU_YyVSmLDLNJo9HKHAy-jYYmnjzThQ8c7E8NfcL3CAMgSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 13, 2020 at 1:49 PM Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>
> On 2020-01-11 17:47, Magnus Hagander wrote:
> > On Sat, Jan 11, 2020 at 5:44 PM Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
> >>
> >> On Sat, Jan 11, 2020 at 08:21:11AM +0100, Peter Eisentraut wrote:
> >>> On 2020-01-06 21:00, Magnus Hagander wrote:
> >>>>> +0.5 to avoid calling OidInputFunctionCall()
> >>>>
> >>>> Or just directly using atol() instead of atoi()? Well maybe not
> >>>> directly but in a small wrapper that verifies it's not bigger than an
> >>>> unsigned?
> >>>>
> >>>> Unlike in cases where we use oidin etc, we are dealing with data that
> >>>> is "mostly trusted" here, aren't we? Meaning we could call atol() on
> >>>> it, and throw an error if it overflows, and be done with it?
> >>>> Subdirectories in the data directory aren't exactly "untrusted enduser
> >>>> data"...
> >>>
> >>> Yeah, it looks like we are using strtoul() without additional error checking
> >>> in similar situations, so here is a patch doing it like that.
> >>
> >>> - true, isDbDir ? pg_atoi(lastDir + 1, sizeof(Oid), 0) : InvalidOid);
> >>> + true, isDbDir ? (Oid) strtoul(lastDir + 1, NULL, 10) : InvalidOid);
> >>
> >> Looking at some other code, I just discovered the atooid() macro that already
> >> does the same, maybe it'd be better for consistency to use that instead?
> >
> > +1. Whie it does the same thing, consistency is good! :)
>
> committed

Thanks!

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-01-13 13:14:52 Re: isTempNamespaceInUse() is incorrect with its handling of MyBackendId
Previous Message Peter Eisentraut 2020-01-13 12:49:35 Re: pg_basebackup fails on databases with high OIDs