public inbox for [email protected]
help / color / mirror / Atom feedFrom: Isaac Morland <[email protected]>
To: Tom Lane <[email protected]>
Cc: Pavel Stehule <[email protected]>
Cc: Ron Johnson <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Request for new column in pg_namespace
Date: Sun, 15 Dec 2024 15:05:46 -0500
Message-ID: <CAMsGm5dm-taSdESDPn1zVLaptKoFHnzJZowx+WJ6f-sr15d3xg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CANzqJaCCF9kpfdbWbRR2xuqH_qaBgL+me13w2c-5S=_YATKh+Q@mail.gmail.com>
<CAFj8pRDxMpQv4P3Bi-zEQ+OQ2dsVCZ+g-vbpU-F3qvozZKjUzA@mail.gmail.com>
<[email protected]>
<CAMsGm5dmNjPuYAg8V7yutENjgJod5pNXhoQpiWoPH3e7i1RrVg@mail.gmail.com>
<[email protected]>
On Sun, 15 Dec 2024 at 14:20, Tom Lane <[email protected]> wrote:
> Isaac Morland <[email protected]> writes:
> > On Sun, 15 Dec 2024 at 12:29, Tom Lane <[email protected]> wrote:
> >> What I'd suggest as an improvement that could be implemented
> >> immediately is to wrap the checks in a user-defined function
> >> like "is_system_schema(nspname name)".
>
> > Would it make sense to make the parameter be of type regnamespace?
>
> Meh ... you could, but what the function really needs is the name.
> Getting from regnamespace (which is an OID) to the name would incur
> an extra syscache lookup. Admittedly, if it removes the need for
> the calling query to join to pg_namespace at all, you'd probably
> come out about even --- the net effect would be about like a
> hashjoin to pg_namespace, I think, since the syscache would act
> like the inner hashtable of a hashjoin.
Thanks for the critique. It occurs to me that this function is perhaps just
as much about “is this name a system-reserved name?” as “is this schema a
system schema?”. So putting in a name that doesn’t actually exist in the
database should be perfectly valid, which of course only works if it takes
a string. Generally speaking I am a big fan of the reg* data types but in
this specific case I think it’s not a clear win. I might still suggest
providing both versions using function overloading.
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Request for new column in pg_namespace
In-Reply-To: <CAMsGm5dm-taSdESDPn1zVLaptKoFHnzJZowx+WJ6f-sr15d3xg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox