Re: Identifying user-created objects - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Identifying user-created objects
Date
Msg-id CA+HiwqGOVhrRyzX6oG+uvdyEgPiXpS8wJ+gjLojoFP=0ePOtZg@mail.gmail.com
Whole thread Raw
In response to Re: Identifying user-created objects  (Masahiko Sawada <masahiko.sawada@2ndquadrant.com>)
Responses Re: Identifying user-created objects
List pgsql-hackers
On Mon, Feb 10, 2020 at 2:23 PM Masahiko Sawada
<masahiko.sawada@2ndquadrant.com> wrote:
> On Mon, 10 Feb 2020 at 14:09, Michael Paquier <michael@paquier.xyz> wrote:
> >
> > On Mon, Feb 10, 2020 at 01:16:30PM +0900, Amit Langote wrote:
> > > On Mon, Feb 10, 2020 at 1:06 PM Masahiko Sawada
> > > <masahiko.sawada@2ndquadrant.com> wrote:
> > >> How about having it as a macro like:
> > >>
> > >> #define ObjectIdIsUserObject(oid) ((Oid)(oid) >= FirstNormalObjectId)
> > >
> > > I'm fine with a macro.
> >
> > I am not sure that it is worth having one extra abstraction layer for
> > that.
>
> Hmm I'm not going to insist on that but I thought that it could
> somewhat improve readability at places where they already compares an
> oid to FirstNormalObjectId as Amit mentioned:
>
> src/backend/catalog/pg_publication.c:       relid >= FirstNormalObjectId;
> src/backend/utils/adt/json.c:               if (typoid >= FirstNormalObjectId)
> src/backend/utils/adt/jsonb.c:              if (typoid >= FirstNormalObjectId)

Agree that ObjectIsUserObject(oid) is easier to read than oid >=
FirstNormalObject.  I would have not bothered, for example, if it was
something like oid >= FirstUserObjectId to begin with.

Thanks,
Amit



pgsql-hackers by date:

Previous
From: Kuntal Ghosh
Date:
Subject: Re: logical decoding : exceeded maxAllocatedDescs for .spill files
Next
From: Masahiko Sawada
Date:
Subject: Re: Internal key management system