
Hi George, On 25-09-2006 07:23:33 -0700, George H wrote:
Hello:
I have a large table (40 million+ rows) that I generated with "copy into" statements using several 1g txt files. The table was subsequently subjected to an "order asc" statement and now I need to add a sequence column to it and there I have a problem. A simple test table illustrates the problem as follows:
sql-> create table test (name varchar(10));
sql->alter table test add column seq serial; Error: ALTER TABLE ADD COLUMN: adding column with key constraint not implemented
Sorry for this, but it is not possible to add such colum afterwards, currently. Why don't you create the table with the sequence, and update the sequence (with ALTER SEQUENCE) afterwards to have the right value?
I have tried several different ways to generate a sequence that work from me in postgres but I continuously run into an error like "primary key constraint violated". The only way I can get it to work is by adding one row at a time.
You have to be a bit more specific here, for me to be able to understand the exact problem you encounter. Which statements do you execute, in what order and how exactly?