Re: Deleting duplicate records - Mailing list pgsql-general

From Dmitry Tkach
Subject Re: Deleting duplicate records
Date
Msg-id 3EDB618A.1080409@openratings.com
Whole thread Raw
In response to Deleting duplicate records  ("Bob Powell" <Bob@hotchkiss.org>)
List pgsql-general
Bob Powell wrote:

>Hello everyone:
>
>Can someone tell me if there is a way to delete duplicate records from a table in Postgres.
>
>I once used a database management system that had a "Delete Duplicates" which would check every field in the row and
ifthey all matched would delete the row.  You could also designate the fields you wanted the command to use to check
fordups.  Very nice feature.  Maybe something for the TODO list?  
>
>
As generally as you state the problem, something like this comes to mind:

select distinct * into temp unique_rows from table_to_cleanup;
truncate table_to_cleanup;
insert into table_to_cleanup select * from unique_rows;

I hope, it helps...

Dima


>Bob Powell
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faqs/FAQ.html
>
>



pgsql-general by date:

Previous
From: "culley harrelson"
Date:
Subject: installing contrib/tsearch with a FreeBSD Port
Next
From: "culley harrelson"
Date:
Subject: installing contrib/tsearch with a FreeBSD Port