oid2name

Started by Alvaro Herreraover 21 years ago2 messages
#1Alvaro Herrera
alvherre@dcc.uchile.cl

Hackers,

I am in the process of fixing the oid2name contrib module. It needs a
lot of care and feeding. Hopefully for the next release we can move it
to src/bin/scripts so it can use the routines that are in common.c, and
some of the ugliness can go.

I think it will stay in contrib for 8.0 however, so it needs to be fixed
now. While I was playing with it, I noticed several shortcomings:

- it only works in the PUBLIC schema
- it only knows about tables and databases, except when running in "show
systables" mode, and then it will show all indexes, toast tables, etc
- it only displays relfilenode and tablename
- there's no way to query by relfilenode, only by Oid (note that the
last two means the program is somewhat inconsistent)

This last one IMHO makes the program somewhat useless, because what the
user normally wants to know is what table does a certain file on disk
belong to, and the Oid may not provide that.

I want to fix this, by providing switches to allow querying by filenode,
Oid and tablename; and to show not only filenode and name, but also
schema and tablespace.

Is this acceptable for this release? Other opinions?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"This is a foot just waiting to be shot" (Andrew Dunstan)

#2Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Alvaro Herrera (#1)
Re: oid2name

Please submit any improvements you can. It certainly needs attention!

I think it is inconsistent in using oid for lookup. It was originally
written before relfilenode existed (hence the name _oid_2name, while it
should be relfilenode to name or something. Maybe when we move it to
scripts we can rename it.

---------------------------------------------------------------------------

Alvaro Herrera wrote:

Hackers,

I am in the process of fixing the oid2name contrib module. It needs a
lot of care and feeding. Hopefully for the next release we can move it
to src/bin/scripts so it can use the routines that are in common.c, and
some of the ugliness can go.

I think it will stay in contrib for 8.0 however, so it needs to be fixed
now. While I was playing with it, I noticed several shortcomings:

- it only works in the PUBLIC schema
- it only knows about tables and databases, except when running in "show
systables" mode, and then it will show all indexes, toast tables, etc
- it only displays relfilenode and tablename
- there's no way to query by relfilenode, only by Oid (note that the
last two means the program is somewhat inconsistent)

This last one IMHO makes the program somewhat useless, because what the
user normally wants to know is what table does a certain file on disk
belong to, and the Oid may not provide that.

I want to fix this, by providing switches to allow querying by filenode,
Oid and tablename; and to show not only filenode and name, but also
schema and tablespace.

Is this acceptable for this release? Other opinions?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"This is a foot just waiting to be shot" (Andrew Dunstan)

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073