Oid registry

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Oid registry
Date: 2012-09-24 22:59:12
Message-ID: 5060E5C0.6080506@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-09-24 23:13:15 Re: pg_reorg in core?
Previous Message Josh Berkus 2012-09-24 22:55:35 Re: pg_reorg in core?