From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
---|---|
To: | amitlangote09(at)gmail(dot)com |
Cc: | masahiko(dot)sawada(at)2ndquadrant(dot)com, michael(at)paquier(dot)xyz, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Identifying user-created objects |
Date: | 2020-02-13 01:28:48 |
Message-ID: | 20200213.102848.1725152441724436363.horikyota.ntt@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
At Mon, 10 Feb 2020 14:32:44 +0900, Amit Langote <amitlangote09(at)gmail(dot)com> wrote in
> On Mon, Feb 10, 2020 at 2:23 PM Masahiko Sawada
> <masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:
> > On Mon, 10 Feb 2020 at 14:09, Michael Paquier <michael(at)paquier(dot)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(dot)sawada(at)2ndquadrant(dot)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.
Aside from the naming, I'm not sure it's sensible to use
FirstNormalObjectId since I don't see a clear definition or required
characteristics for "user created objects" is. If we did CREATE
TABLE, FUNCTION or maybe any objects during single-user mode before
the first object is created during normal multiuser operation, the
"user-created(or not?)" object has an OID less than
FirstNormalObjectId. If such objects are the "user created object", we
need FirstUserObjectId defferent from FirstNormalObjectId.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2020-02-13 01:51:44 | Re: Getting rid of some more lseek() calls |
Previous Message | Tom Lane | 2020-02-13 01:25:39 | Re: [PATCH] libpq improvements and fixes |