Re: Allowing extensions to find out the OIDs of their member objects

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Allowing extensions to find out the OIDs of their member objects
Date: 2019-01-22 01:26:58
Message-ID: 877eex4hlr.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

Tom> I thought about extending the extension infrastructure to provide
Tom> some way of retrieving relevant OIDs. We could imagine, for
Tom> instance, that an extension script has a way to say "this function
Tom> is object number three within this extension", and while running
Tom> the script we make a catalog entry showing that object number
Tom> three has OID thus-and-so, and then that catalog entry can be
Tom> consulted to get the right OID (by C code that has hard-wired
Tom> knowledge that object number three is the function it cares
Tom> about). This is still kind of messy, because aside from the
Tom> hand-assigned object numbers you'd have to use the extension name
Tom> as part of the lookup key, making the name into something the C
Tom> code critically depends on. We don't have ALTER EXTENSION RENAME,
Tom> so maybe that's okay, but it seems painful to say that we can
Tom> never have it.

I suggest using string tags rather than object numbers:

1. easier to read and maintain

2. an object might be given many tags, some of them automatically

3. it might make sense to provide a function that the extension can use
to ask "is oid X one of my objects with tag 'foo'" (e.g. to match one of
a set of related functions) in addition to looking up specific oids by
tag

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2019-01-22 01:29:06 Re: explain plans with information about (modified) gucs
Previous Message Andres Freund 2019-01-22 01:15:17 Re: Pluggable Storage - Andres's take