View Single Post

   
  #1 (permalink)  
Old 04-17-2008, 09:42 PM
Gerry Jensen
 
Posts: n/a
Default duplicate rows mystery

I'm trying to remove duplicate records from a table. The best way I could
think of was to select into a new table using DISTINCT.

I issued the following command:

select distinct on (symbol, date) * into price from pricebackup;

It did indeed remove several rows that had duplicate items. I then tried
to build a unique index on the columns (symbol, date) in pricebackup with:

create unique index price_symbol_date on pricebackup (symbol, date);

and got the error:

ERROR: could not create unique index
DETAIL: Table contains duplicated values.

How is it possible that I could have duplicate values in that table when I
just selected them into the table as distinct? What am I missing?

Any help is appreciated.

Thanks,

Gerry

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply With Quote