Oid registry - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Oid registry
Date
Msg-id 5060E5C0.6080506@dunslane.net
Whole thread Raw
Responses Re: Oid registry
Re: Oid registry
Re: Oid registry
List pgsql-hackers
This rather overdue mail arises out the developer's meeting back in May, 
where we discussed an item I raised suggesting an Oid registry.

The idea came from some difficulties I encountered when I did the 
backport of the JSON work we did in 9.2 to 9.1, but has wider 
application. Say someone writes an extension that defines type A. You 
want to write an extension that takes advantage of that type, but it's 
difficult if you don't know the type's Oid, and of course currently 
there is no way of knowing for sure what it is unless it's a builtin 
type. So the proposal is to have an Oid registry, in which authors could 
in effect reserve an Oid (or a couple of Oids) for a type. We would 
guarantee that these Oids would be reserved in just the same way Oids 
for builtins are reserved, and #define symbolic constants for the 
reserved Oids. To make that viable, we'd need to extend the CREATE 
commands for any objects we could reserve Oids for to allow for the 
specification of the Oids, somewhat like:
   CREATE TYPE newtype ( ....) WITH (TYPEOID = 123456, TYPEARRAYOID =   234567);

I'm not sure what objects we would need this for other than types, but 
CREATE TYPE would be a good start anyway.

Another suggestion that was made during the discussion was that we 
should also reserve a range of Oids for private use, and guarantee that 
those would never be allocated, somewhat analogously to RFC1918 IP 
addresses.

thoughts?

If there is general agreement I want to get working on this fairly soon.

cheers

andrew





pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: pg_reorg in core?
Next
From: Andres Freund
Date:
Subject: Re: pg_reorg in core?