Re: pg_restore error

Поиск
Список
Период
Сортировка
Искать
От
Adam Witney
Тема
Re: pg_restore error
Дата
Msg-id
B9CB43F6.9465%a.witney@sghms.ac.uk
Ответ на
Re: pg_restore error (pascal bérest)
Список
Дерево обсуждения
pg_restore error pascal bérest <lists@magnetophone.com>
Re: pg_restore error Adam Witney <awitney@sghms.ac.uk>
Re: pg_restore error pascal bérest <lists@magnetophone.com>
Re: pg_restore error Adam Witney <awitney@sghms.ac.uk>
Re: pg_restore error pascal bérest <lists@magnetophone.com>
Re: pg_restore error Adam Witney <awitney@sghms.ac.uk>
>>>  I tried with the -a option, and it was quite the same.
>>>  I just tried to delete the synd_article_pkey  then restore the table
>>>  synd_article, but it didn't recreate the keys as they were. and i
>>>  don't know how to do that (as i am using mysql for my other projects
>>>  and that it seams to be more simple).
>>> 
>> 
>> What happened when you tried the -a option?
> 
> i have quite the same error. i have a message telling that the key
> can't be duplicate. i suppose that as the id is already existing, it
> can't duplicate it, as in mysql.
> 
>> You can create a table with a primary key like so
>> 
>> CREATE TABLE test (
>>   id int,
>>  PRIMARY KEY (id)
>> );
> 
> yep, but is a way to create a primary key when the table already exists ?

It seems that your dump file contains data that is already in the database
and so it is complaining when you try to duplicate a primary key

What exactly are you trying to do with your dump and restore?

pg_dump will archive all the data from a table and pg_restore will restore
all the data back into an empty table.

Take a look here for more details

http://www.postgresql.org/idocs/index.php?backup.html

I think the ability to add a primary key after table creation is only
available as of version 7.3 (currently in beta)

HTH

adam

В списке pgsql-general по дате отправления
От: Ian Harding
Дата:
От: Tom Lane
Дата:
Сообщение: Re: Server locale?
FAQ