Any reason to keep HEAP_HASOID_OLD?

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>
Subject: Any reason to keep HEAP_HASOID_OLD?
Date: 2026-04-28 04:27:59
Message-ID: CAApHDvqB=kapsgwvLiPZRhfyFcJB6nw-Xs2D-jHm6ddRcxP7zA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres mentioned to me that I might want to look at
HeapTupleHeaderGetOidOld() as there's a comment and some code there
that would lead you to believe we can still have tuples with oids. If
that were true, the code I recently added for getting 'tp' in
slot_selectively_deform_heap_tuple() is wrong.

#define HEAP_HASOID_OLD 0x0008 /* has an object-id field */

On 11.22, I tried:

create extension pageinspect;
create table t1 (a int) with oids;
insert into t1 select generate_Series(1,1000);
select count(*) from heap_page_items(get_raw_page('public.t1',0))
where t_infomask & 8 <> 0;

count
-------
185

alter table t1 set without oids;

select count(*) from heap_page_items(get_raw_page('public.t1',0))
where t_infomask & 8 <> 0;
count
-------
0

And also, if I try to pg_upgrade before SET WITHOUT OIDS, I get:

$ pg_upgrade -d pgdata11 -D pgdata -b ~/pg11/bin -B ~/pg/bin
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is the install user ok
Checking database connection settings ok
Checking for prepared transactions ok
Checking for system-defined composite types in user tables ok
Checking for reg* data types in user tables ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for user-defined encoding conversions ok
Checking for user-defined postfix operators ok
Checking for incompatible polymorphic functions ok
Checking for tables WITH OIDS fatal

So, I'm not following how we could get a tuple with OIDs in versions after 11.

Should we get rid of HEAP_HASOID_OLD and the code that relates to it?

David

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-04-28 04:31:02 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Haibo Yan 2026-04-28 04:27:16 Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM