pg_restore peculiarities

Поиск
Список
Период
Сортировка
От Tim Penhey
Тема pg_restore peculiarities
Дата
Msg-id 414C4FB2.5090806@penhey.net
обсуждение исходный текст
Ответы Re: pg_restore peculiarities  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Maybe it's just me, but I can't seem to get pg_restore to restore a
database...

I am running 8.0 beta 2 (using the dev3 installer) on Windows XP.

I created a very simple database with one table and one function and
dumped it out using:

pg_dump -U postgres -F c -f test.dump test

This worked fine, although the compressed file was 120 K (ish).
Although this might have something to do with the database having 258
functions and a number of operators and operator classes (visible
through pgAdmin III).  Following the examples in the docs, I created a
new database and tried to restore into that using

pg_restore -U postgres -d test_restored test.dump

But it gives about 117K of error messages starting with:
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC Entry 17; 1255 17228 FUNCTION
plpgsql_call_handler() postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function
"plpgsql_call_handler" already exists with same argument types
    Command was: CREATE FUNCTION plpgsql_call_handler() RETURNS
language_handler
    AS '$libdir/plpgsql', 'plpgsql_call_handler'
    LANGUAG...
pg_restore: [archiver (db)] Error from TOC Entry 18; 1255 17229 FUNCTION
plpgsql_validator(oid) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function
"plpgsql_validator" already exists with same argument types
    Command was: CREATE FUNCTION plpgsql_validator(oid) RETURNS void
    AS '$libdir/plpgsql', 'plpgsql_validator'
    LANGUAGE c;
pg_restore: [archiver (db)] Error from TOC Entry 535; 16402 17230
PROCEDURAL LANGUAGE plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR:  language
"plpgsql" already exists
    Command was: CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER
plpgsql_call_handler VALIDATOR plpgsql_validator;

Even trying to restore data only gives duplicate key constraint errors.

Now this might seem simple, but all I want to be able to do is to backup
all the data in about 20 or so tables (all the non-system tables in a
DB, and their associated sequences), and be able to restore the data in
the tables back to that state at a later date.  Now I assumed that
pg_dump and pg_restore would be the easiest ways to do this, but I can't
even seem to get a simple case working.

Does anyone know the magic word to get this working?

Thanks
Tim


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: How to find a column name
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Vacuum related question