Hi Michael

On Thu, Dec 4, 2025 at 1:46 AM Michael Paquier <[email protected]> wrote:
>
> On Tue, Dec 02, 2025 at 11:36:39AM +0100, David Bidoc wrote:
> > I attached the rebased patch.
> > Any feedback would be appreciated.
>
> Your patch still fails to apply on HEAD for all the changes of
> contrib/oid2name/oid2name.c.  Please see the following:
> https://commitfest.postgresql.org/patch/6111/
>

Thank you for your feedback.
I attached the rebased and updated patch.

> It also seems like Euler's feedback has not been answered.  I am
> pretty sure that he was referring about the addition of an example in
> the documentation, or at least refreshing the areas of the docs that
> are impacted with your change (no clear idea about all that without a
> rebased patch).

I updated the documentation example about the -x option :

$ # you can mix the options, and get more details with -x
$ oid2name -d alvherre -t accounts -f 1155291 -x
>From database "alvherre":
  Filenode     Table Name      Oid  Schema  Tablespace            Filepath
--------------------------------------------------------------------------
    155173       accounts   155173  public  pg_default   base/17228/155173
   1155291  accounts_pkey  1155291  public  pg_default  base/17228/1155291

I modified the example already used to maintain consistency.

--
David Bidoc
diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c
index 51802907138..e0b1aa0d31a 100644
--- a/contrib/oid2name/oid2name.c
+++ b/contrib/oid2name/oid2name.c
@@ -469,7 +469,7 @@ void
 sql_exec_dumpalltables(PGconn *conn, struct options *opts)
 {
 	char		todo[1024];
-	char	   *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" ";
+	char	   *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\", pg_relation_filepath(c.oid) as \"Filepath\" ";
 
 	snprintf(todo, sizeof(todo),
 			 "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s "
@@ -507,7 +507,7 @@ sql_exec_searchtables(PGconn *conn, struct options *opts)
 			   *comma_filenumbers,
 			   *comma_tables;
 	bool		written = false;
-	char	   *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" ";
+	char	   *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\", pg_relation_filepath(c.oid) as \"Filepath\" ";
 
 	/* get tables qualifiers, whether names, filenumbers, or OIDs */
 	comma_oids = get_comma_elts(opts->oids);
diff --git a/doc/src/sgml/oid2name.sgml b/doc/src/sgml/oid2name.sgml
index 54cc9be2b82..7a595866425 100644
--- a/doc/src/sgml/oid2name.sgml
+++ b/doc/src/sgml/oid2name.sgml
@@ -118,7 +118,7 @@
      <term><option>-x</option></term>
      <term><option>--extended</option></term>
      <listitem><para>display more information about each object shown: tablespace name,
-      schema name, and OID.
+      schema name, OID and file path..
      </para></listitem>
     </varlistentry>
 
@@ -299,10 +299,10 @@ From database "alvherre":
 $ # you can mix the options, and get more details with -x
 $ oid2name -d alvherre -t accounts -f 1155291 -x
 From database "alvherre":
-  Filenode     Table Name      Oid  Schema  Tablespace
-------------------------------------------------------
-    155173       accounts   155173  public  pg_default
-   1155291  accounts_pkey  1155291  public  pg_default
+  Filenode     Table Name      Oid  Schema  Tablespace            Filepath
+--------------------------------------------------------------------------
+    155173       accounts   155173  public  pg_default   base/17228/155173
+   1155291  accounts_pkey  1155291  public  pg_default  base/17228/1155291
 
 $ # show disk space for every db object
 $ du [0-9]* |

Reply via email to