Re: rebuilding a table from a datafile

From: brianb-pggeneral(at)edsamail(dot)com
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: rebuilding a table from a datafile
Date: 2000-08-16 21:27:04
Message-ID: 20000816212704.2146.qmail@mail01.edsamail.com.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Ross J. Reedstrom writes:

> On Wed, Aug 16, 2000 at 02:36:10PM +0000, brianb-pggeneral(at)edsamail(dot)com wrote:
> >
> > This is with regards to Postgres 6.5.
> >
> > While trying to ALTER RENAME a large table (203MB data file), an error
> > occured. \d displays the new table name, but there is no corresponding
> > file. a file with the original table name still exists, so presumably the
> > data is not lost. Is it possible for me to undo the RENAME by massaging the
> > pg_* tables, or otherwise retrieve the data in the table? It was an
> > insert-only table, and no deletes or updates were ever performed on it.
>
> Hmm, what kind of failure mode caused this? Reading the renamrel code for
> 6.5.3, it does the file rename first, then updates pg_class. Anyway,
> I'd try manually renaming the file to the name that appears in pg_class,
> rather than trying to fixup the system relations. There're indices on
> pg_class that're hard to rebuild under 6.5.X.
>
> If that doesn't work, try updating pg_class.relname to mach the filename.
> you'll need to be a DB superuser to do that.

I am getting a "ERROR: cannot find attribute 1 of relation foo" when I try
to SELECT * from the table. Also, \d foo produces "Couldn't find table
foo!", but it is listed in pg_class.

Is it safe/advisable to modify pg_attribute directly in this case? I have
several other tables with the exact same structure that I can use as
reference.

Brian
--
Brian Baquiran <brianb(at)edsamail(dot)com>
http://www.baquiran.com/ AIM: bbaquiran
Work: +63(2)7182222 Home: +63(2) 9227123

I'm smarter than average. Therefore, average, to me, seems kind of stupid.
People weren't purposely being stupid. It just came naturally.
-- Bruce "Tog" Toganazzini

In response to

Browse pgsql-general by date

  From Date Subject
Next Message George Robinson II 2000-08-16 22:28:14 YAIQ (yet another inane question)
Previous Message Craig Johannsen 2000-08-16 21:11:33 Re: Problems after instaling PostgreSQL 7.0