pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Why does the OID jump by 3 when creating tables?
Date: Sat, 30 Oct 2021 10:04:46 -0500
Message-ID: <be8d2870-bc8f-394e-0737-aa73259af059@gmail.com> (raw)
In-Reply-To: <ZR0P278MB092061F8F01770B16DFAB4A4D2889@ZR0P278MB0920.CHEP278.PROD.OUTLOOK.COM>
References: <ZR0P278MB092061F8F01770B16DFAB4A4D2889@ZR0P278MB0920.CHEP278.PROD.OUTLOOK.COM>

On 10/30/21 3:55 AM, Daniel Westermann (DWE) wrote:
> 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
>

I'd run this, and see if the results answer the question:

select oid,relname, reltype from pg_class where oid between 16453 and 16455;

-- 
Angular momentum makes the world go 'round.





view thread (4+ messages)

Message-ID: <be8d2870-bc8f-394e-0737-aa73259af059@gmail.com>
Permalink:  ../be8d2870-bc8f-394e-0737-aa73259af059@gmail.com/
Also on:    postgresql.org/message-id/be8d2870-bc8f-394e-0737-aa73259af059@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Why does the OID jump by 3 when creating tables?
  In-Reply-To: <be8d2870-bc8f-394e-0737-aa73259af059@gmail.com>
  References: <ZR0P278MB092061F8F01770B16DFAB4A4D2889@ZR0P278MB0920.CHEP278.PROD.OUTLOOK.COM> <be8d2870-bc8f-394e-0737-aa73259af059@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox