Re: Thanks, naming conventions, and count()

From: Vince Vielhaber <vev(at)michvhf(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: The Hermit Hacker <scrappy(at)hub(dot)org>, Casey Lyon <casey(at)earthcars(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Thanks, naming conventions, and count()
Date: 2001-04-30 10:03:22
Message-ID: Pine.BSF.4.30.0104300600500.21796-100000@paprika.michvhf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)michvhf(dot)com http://www.pop4.net
56K Nationwide Dialup from $16.00/mo at Pop4 Networking
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ken Hirsch 2001-04-30 10:57:10 Re: Learning from other open source databases
Previous Message Alfred Perlstein 2001-04-30 09:35:51 COPY commands could use an enhancement.