oid2name : add objects file path

David Bidoc <dcbidoc@gmail.com>

From: David Bidoc <dcbidoc@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2025-10-07T08:55:14Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. oid2name: Add relation path to the information provided by -x/--extended

Attachments

Hello,

This is my first patch to the project.

I noticed that the oid2name tool does not display the file path of objects.

I thought this could be interesting and that others might find it useful,
so I made a little patch to display the full path of objects retrieved by
the oid2name tool. These will be displayed using the -x --extended option.

$ oid2name -p 5435 -x
All databases:
    Oid  Database Name  Tablespace    Filepath
----------------------------------------------
  16392             b1  pg_default  base/16392
      5       postgres  pg_default      base/5
      4      template0  pg_default      base/4
      1      template1  pg_default      base/1

$ oid2name -p 5435 -d b1 -x
>From database "b1":
  Filenode  Table Name    Oid  Schema  Tablespace          Filepath
-------------------------------------------------------------------
     16393          t1  16393  public  pg_default  base/16392/16393

$ oid2name -p 5435 -d b1 -i -x
>From database "b1":
  Filenode  Table Name    Oid  Schema  Tablespace          Filepath
-------------------------------------------------------------------
     16393          t1  16393  public  pg_default  base/16392/16393
     16396   t1_c1_idx  16396  public  pg_default  base/16392/16396

Regards

David Bidoc