Re: lost tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: lost tables
Дата
Msg-id 2682.1049226858@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: lost tables  ("Josh Goldberg" <josh@4dmatrix.com>)
Ответы Documentation for the \lo_export and \lo_import commands  ("Chris White" <cjwhite@cisco.com>)
Список pgsql-admin
"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


В списке pgsql-admin по дате отправления:

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: Backup features available for postgres database
Следующее
От: "Chris White"
Дата:
Сообщение: Documentation for the \lo_export and \lo_import commands