Re: Thanks, naming conventions, and count() - Mailing list pgsql-hackers

From Vince Vielhaber
Subject Re: Thanks, naming conventions, and count()
Date
Msg-id Pine.BSF.4.30.0104300600500.21796-100000@paprika.michvhf.com
Whole thread Raw
In response to Re: Thanks, naming conventions, and count()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Thanks, naming conventions, and count()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, 29 Apr 2001, Bruce Momjian wrote:

> > > 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!

But would it work on a crashed database that won't come up or doesn't
the direct connect care about any other tables in this usage?

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net        56K Nationwide Dialup from $16.00/mo
atPop4 Networking       Online Campground Directory    http://www.camping-usa.com      Online Giftshop Superstore
http://www.cloudninegifts.com
==========================================================================





pgsql-hackers by date:

Previous
From: Alfred Perlstein
Date:
Subject: COPY commands could use an enhancement.
Next
From: "Ken Hirsch"
Date:
Subject: Re: Learning from other open source databases