Re: translating filenames into tablenames?

Lists: pgsql-general
From: "Ed L(dot)" <pggeneral(at)bluepolka(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: translating filenames into tablenames?
Date: 2003-02-11 19:08:15
Message-ID: 200302111208.15725.pggeneral@bluepolka.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


Could someone point me to the docs or remind me of the tool that
allows me to translate filenames under $PGDATA/base/ into the
corresponding DB object name? I know this is an FAQ, but I didn't
see it.

Thanks in advance.


From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: "Ed L(dot)" <pggeneral(at)bluepolka(dot)net>
Subject: Re: translating filenames into tablenames?
Date: 2003-02-11 21:37:39
Message-ID: 3E496D23.2090009@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

select relname from pg_class where oid = <filename_without_extension>

should do it...

I hope, it helps..

Dima

Ed L. wrote:
> Could someone point me to the docs or remind me of the tool that=20
> allows me to translate filenames under $PGDATA/base/ into the=20
> corresponding DB object name? I know this is an FAQ, but I didn't=20
> see it.
>
> Thanks in advance.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Ed L(dot)" <pggeneral(at)bluepolka(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: translating filenames into tablenames?
Date: 2003-02-13 01:06:50
Message-ID: 200302130106.h1D16pH09156@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


I think you want /contrib/oid2name.

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

Ed L. wrote:
>
> Could someone point me to the docs or remind me of the tool that
> allows me to translate filenames under $PGDATA/base/ into the
> corresponding DB object name? I know this is an FAQ, but I didn't
> see it.
>
> Thanks in advance.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

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


From: Medi Montaseri <medi(dot)montaseri(at)intransa(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Ed L(dot)" <pggeneral(at)bluepolka(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: translating filenames into tablenames?
Date: 2003-02-13 01:31:39
Message-ID: 3E4AF57B.3080303@intransa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

You can also write your own based on

The following that I call ols (oid ls)

----------------------------------- cut
----------------------------------------
#!/bin/bash

DIR=$1

cd $DIR
for file in `ls -S`
do
psql -qc "select relid,relname from pg_stat_all_tables where
relid=$file" | grep $file
done

----------------------------------- cut again
--------------------------------------

yes, it could be optimized...

Bruce Momjian wrote:

>I think you want /contrib/oid2name.
>
>---------------------------------------------------------------------------
>
>Ed L. wrote:
>
>
>>Could someone point me to the docs or remind me of the tool that
>>allows me to translate filenames under $PGDATA/base/ into the
>>corresponding DB object name? I know this is an FAQ, but I didn't
>>see it.
>>
>>Thanks in advance.
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 4: Don't 'kill -9' the postmaster
>>
>>
>>
>
>
>