Re: pg_restore error

From: Adam Witney <awitney(at)sghms(dot)ac(dot)uk>
To: pascal b=?ISO-8859-1?B?6Q==?=rest <lists(at)magnetophone(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_restore error
Date: 2002-10-10 13:49:26
Message-ID: B9CB43F6.9465%a.witney@sghms.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-10-10 14:06:58 Re: Server locale?
Previous Message Shridhar Daithankar 2002-10-10 13:49:11 Re: contrib/fixchar (Was: Large databases, performance)