Re: Thanks, naming conventions, and count()
От | Bruce Momjian |
---|---|
Тема | Re: Thanks, naming conventions, and count() |
Дата | |
Msg-id | 200104300346.f3U3kct12404@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Thanks, naming conventions, and count() (The Hermit Hacker <scrappy@hub.org>) |
Ответы |
Re: Thanks, naming conventions, and count()
|
Список | pgsql-hackers |
> > I think parsing the file contents is too hard. The database would have > > to be running and I would use psql. > > I don't know, I recovered someone's database using a "raw" connection ... > wasn't that difficult once I figured out the format *shrug* > > the following gets the oid,relname's for a database in the format: > > echo "select oid,relname from pg_class" | postgres -L -D /usr/local/pgsql/data eceb | egrep "oid|relname" > > then just parse the output using a simple perl script: > > 1: oid = "163338" (typeid = 26, len = 4, typmod = -1, byval = t) > 2: relname = "auth_info_uid_key" (typeid = 19, len = 32, typmod = -1, byval = f) > 1: oid = "163341" (typeid = 26, len = 4, typmod = -1, byval = t) > 2: relname = "auth_info_id" (typeid = 19, len = 32, typmod = -1, byval = f) > 1: oid = "56082" (typeid = 26, len = 4, typmod = -1, byval = t) > 2: relname = "auth_info" (typeid = 19, len = 32, typmod = -1, byval = f) Oh, you did a direct postgres backend connect. Yes, that will work fine. Good idea if the postmaster is down. I originally thought you meant reading the pg_class file raw. Of course, that would be really hard because there is no way to know what numeric file is pg_class! Actually, seems it is always 1259. I see this in include/catalog/pg_class.h: DATA(insert OID = 1259 ( pg_class 83 PGUID 0 1259 0 0 0 0 f f r22 0 0 0 0 0 f f f _null_ )); -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026
В списке pgsql-hackers по дате отправления: