On Wed, Jan 17, 2001 at 05:49:36PM -0500, Bruce Momjian wrote:
> Wow, this looks great, and it worked the first time too.  I will commit
> if no one makes objects.
> 

I object. The code displays oids and tablenames or relnames. Oid is just
the initial, default filename for tables, and may change to something other
than the oid. Currently, the reindex code is the only place that could change
the relfilenode without changing the oid, but I think there may be more
in the future.

Here's a patch to Brandon's code (completely untested, BTW):

Ross

*** oid2name.c.orig     Wed Jan 17 17:12:05 2001
--- oid2name.c  Wed Jan 17 17:27:11 2001
***************
*** 331,339 ****
  
    /* don't exclude the systables if this is set */
    if(systables == 1)
!     sprintf(todo, "select oid,relname from pg_class order by relname");
    else
!     sprintf(todo, "select oid,relname from pg_class where relname not like 'pg_%%' 
order by relname");
  
    sql_exec(conn, todo, NULL);
  }
--- 331,339 ----
  
    /* don't exclude the systables if this is set */
    if(systables == 1)
!     sprintf(todo, "select relfilenode,relname from pg_class order by relname");
    else
!     sprintf(todo, "select relfilenode,relname from pg_class where relname not like 
'pg_%%' order by relname");
  
    sql_exec(conn, todo, NULL);
  }
***************
*** 348,354 ****
    todo = (char *) malloc (1024);
  
    /* get the oid and tablename where the name matches tablename */
!   sprintf(todo, "select oid,relname from pg_class where relname = '%s'", tablename);
  
    returnvalue = sql_exec(conn, todo, 1);
  
--- 348,354 ----
    todo = (char *) malloc (1024);
  
    /* get the oid and tablename where the name matches tablename */
!   sprintf(todo, "select relfilenode,relname from pg_class where relname = '%s'", 
tablename);
  
    returnvalue = sql_exec(conn, todo, 1);
  
***************
*** 372,378 ****
  
    todo = (char *) malloc (1024);
  
!   sprintf(todo, "select oid,relname from pg_class where oid = %i", oid);
  
    returnvalue = sql_exec(conn, todo, 1);
  
--- 372,378 ----
  
    todo = (char *) malloc (1024);
  
!   sprintf(todo, "select relfilenode,relname from pg_class where relfilenode = %i", 
oid);
  
    returnvalue = sql_exec(conn, todo, 1);
  

Reply via email to