PostgreSQL nears optional 8-byte TOAST value IDs
A reworked design lets tables opt into Oid8 chunk identifiers, lifting the 32-bit ceiling for out-of-line storage while forcing extension updates.
PostgreSQL is advancing optional 8-byte identifiers for TOAST, the out-of-line store for oversized column values, so very large databases can keep assigning unique chunk IDs after the classic 32-bit OID space is exhausted.
Michael Paquier is driving the work on the pgsql-hackers list. An earlier callback-per-vartag design drew objections over indirection and performance. The current approach picks OID or Oid8 external pointers from the vartag or the TOAST relation attribute type, with no function pointers. Tables opt in through a toast_value_type reloption (oid by default, or oid8). Dumps, binary upgrades, and rewrites such as VACUUM FULL, CLUSTER, and REPACK keep the chosen type; a table already tied to one flavor cannot switch via rewrite.
Wider counters come from an extended control-file field and skip the reserved low range on wraparound, matching existing OID practice. Review coverage now includes standby promotion, crash recovery, logical decoding past four billion, and pg_upgrade in both directions.
Oleg Bartunov warned that extensions such as PostGIS and MobilityDB treat the on-disk external predicate as implying the old OID pointer layout, so an Oid8 datum could be misread. Paquier replied that renaming the old structure forces a compile break rather than a silent runtime failure, that the predicate now means any on-disk external pointer while the vartag selects the concrete form, and that he is willing to help adjust PostGIS.
The remaining pieces add the Oid8 pointer form and tests that push chunk IDs past 2^32. Extension authors who touch TOAST pointer layouts will need version-gated updates when the feature lands.