pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Goldberg <josh@4dmatrix.com>
Cc: postgres-admin <pgsql-admin@postgresql.org>
Subject: Re: lost tables
Date: Tue, 01 Apr 2003 14:54:18 -0500
Message-ID: <2682.1049226858@sss.pgh.pa.us> (raw)
In-Reply-To: <072901c2f885$f3895e00$6e02a8c0@4dmatrix.com>
References: <04c601c2f4d4$16f90da0$6e02a8c0@4dmatrix.com>
	<069801c2f7c3$5e33c650$6e02a8c0@4dmatrix.com>
	<27717.1049168564@sss.pgh.pa.us>
	<072901c2f885$f3895e00$6e02a8c0@4dmatrix.com>

"Josh Goldberg" <josh@4dmatrix.com> writes:
> cms3=# drop table view_log;
> NOTICE:  RelationBuildDesc: can't open view_log: No such file or directory
> ERROR:  cannot open view_log: No such file or directory

You should be able to get to a state where you can drop the table by
doing

	touch $PGDATA/base/dbnumber/filenumber

where filenumber is the pg_class.relfilenode entry for the table (19433
here), and dbnumber is the pg_database.oid entry for the database.

If there is still a symlink in that position, either remove it and do
the touch to make a plain file, or do a touch where the symlink points
instead.

You may need to repeat for each index used by the table, if you moved
those off too.

BTW, recent versions (7.3 at least, and I think 7.2) will allow a DROP
TABLE without insisting on finding an underlying file, for example:

regression=# create table z(f1 int);
CREATE TABLE
regression=# select relfilenode from pg_class where relname = 'z';
 relfilenode
-------------
     2204132
(1 row)

-- as postgres, rm the file 2204132

regression=# drop table z;
WARNING:  cannot unlink 2066720/2204132: No such file or directory
DROP TABLE


			regards, tom lane




view thread (5+ messages)

Message-ID: <2682.1049226858@sss.pgh.pa.us>
Permalink:  ../2682.1049226858@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2682.1049226858@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, josh@4dmatrix.com
  Subject: Re: lost tables
  In-Reply-To: <2682.1049226858@sss.pgh.pa.us>
  References: <04c601c2f4d4$16f90da0$6e02a8c0@4dmatrix.com> <069801c2f7c3$5e33c650$6e02a8c0@4dmatrix.com> <27717.1049168564@sss.pgh.pa.us> <072901c2f885$f3895e00$6e02a8c0@4dmatrix.com> <2682.1049226858@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox