Why does the OID jump by 3 when creating tables?

From: "Daniel Westermann (DWE)" <daniel(dot)westermann(at)dbi-services(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Why does the OID jump by 3 when creating tables?
Date: 2021-10-30 08:55:34
Message-ID: ZR0P278MB092061F8F01770B16DFAB4A4D2889@ZR0P278MB0920.CHEP278.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

as I could not find the reason in the source code, can someone tell me why the OID counter jumps by 3 between two create table statements?

postgres=# create table t1 ( a int );
CREATE TABLE
postgres=# create table t2 ( a int );
CREATE TABLE
postgres=# select oid,relname from pg_class where relname in ('t1','t2');
oid | relname
-------+---------
16453 | t1
16456 | t2
(2 rows)

These seems not to happen with other objects, e.g. namespaces:

postgres=# create schema a;
CREATE SCHEMA
postgres=# create schema b;
CREATE SCHEMA
postgres=# select oid,nspname from pg_namespace where nspname in ('a','b');
oid | nspname
-------+---------
16459 | a
16460 | b
(2 rows)

... or indexes:

postgres=# select oid,relname from pg_class where relname in ('i1','i2');
oid | relname
-------+---------
16461 | i1
16462 | i2

Thanks in advance
Daniel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2021-10-30 09:51:04 Re: Why does the OID jump by 3 when creating tables?
Previous Message Philip Semanchuk 2021-10-29 18:44:15 Re: psql syntax for array of strings in a variable?