Re: duplicate records

From: "Thomas J Keller" <kellert(at)ohsu(dot)edu>
To: pdxpug(at)postgresql(dot)org
Subject: Re: duplicate records
Date: 2006-10-18 22:16:23
Message-ID: 93479223-79AF-4ED3-A824-D1DBB646D5D5@ohsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

Excellent.
So the first step is to create an empty table:

passwords=# CREATE TABLE foo_bar LIKE original_table;
ERROR: syntax error at or near "LIKE" at character 22
LINE 1: CREATE TABLE foo_bar LIKE original_table;
^

What the heck is wrong with it??

thanks,
Tom K
PS. I working with v8.1.4

On Oct 18, 2006, at 2:43 PM, Selena Deckelmann wrote:

>
> On Oct 18, 2006, at 2:23 PM, Thomas J Keller wrote:
>
>> Greetings,
>> Is it appropriate to ask an operational question - not necessarily
>> unique to postgresql?
>>
>> I inserted a few hundred records into a new database table and
>> discovered that several where duplicates.
>> How does one select these (so they can be deleted)?
>
> You could create a temporary table, SELECT DISTINCT from your
> problem table, drop the original table, and then move your temp
> table data into the original table.
>
> If your primary key has duplicates, you'll need to make your
> temporary table a little different than your original table.
>
> -selena
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Vassilis Papadimos 2006-10-18 22:24:01 Re: duplicate records
Previous Message Selena Deckelmann 2006-10-18 21:43:17 Re: duplicate records