pgsql: Create a script that can renumber manually-assigned OIDs. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Create a script that can renumber manually-assigned OIDs.
Date
Msg-id E1h3kIi-0005Ey-DO@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Create a script that can renumber manually-assigned OIDs.

This commit adds a Perl script renumber_oids.pl, which can reassign a
range of manually-assigned OIDs to someplace else by modifying OID
fields of the catalog *.dat files and OID-assigning macros in the
catalog *.h files.

Up to now, we've encouraged new patches that need manually-assigned
OIDs to use OIDs just above the range of existing OIDs.  Predictably,
this leads to patches stepping on each others' toes, as whichever
one gets committed first creates an OID conflict that other patch
author(s) have to resolve manually.  With the availability of
renumber_oids.pl, we can eliminate a lot of this hassle.
The new project policy, therefore, is:

* Encourage new patches to use high OIDs (the documentation suggests
choosing a block of OIDs at random in 8000..9999).

* After feature freeze in each development cycle, run renumber_oids.pl
to move all such OIDs down to lower numbers, thus freeing the high OID
range for the next development cycle.

This plan should greatly reduce the risk of OID collisions between
concurrently-developed patches.  Also, if such a collision happens
anyway, we have the option to resolve it without much effort by doing
an off-schedule OID renumbering to get the first-committed patch out
of the way.  Or a patch author could use renumber_oids.pl to change
their patch's assignments without much pain.

This approach does put a premium on not hard-wiring any OID values
in places where renumber_oids.pl and genbki.pl can't fix them.
Project practice in that respect seems to be pretty good already,
but a follow-on patch will sand down some rough edges.

John Naylor and Tom Lane, per an idea of Peter Geoghegan's

Discussion: https://postgr.es/m/CAH2-WzmMTGMcPuph4OvsO7Ykut0AOCF_i-=eaochT0dd2BN9CQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a6417078c4140e51cfd717448430f274b449d687

Modified Files
--------------
doc/src/sgml/bki.sgml                |  40 ++++-
src/backend/catalog/Catalog.pm       |   2 +
src/include/catalog/indexing.h       |   3 +
src/include/catalog/renumber_oids.pl | 291 +++++++++++++++++++++++++++++++++++
src/include/catalog/toasting.h       |   3 +
src/tools/RELEASE_CHANGES            |  16 +-
6 files changed, 350 insertions(+), 5 deletions(-)


pgsql-committers by date:

Previous
From: Etsuro Fujita
Date:
Subject: pgsql: Fix testing of parallel-safety of scan/join target.
Next
From: Tom Lane
Date:
Subject: pgsql: Add support for hyperbolic functions, as well as log10().