Re: how to update table to make dup values distinct - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: how to update table to make dup values distinct
Date
Msg-id 20051111050541.GA22400@wolff.to
Whole thread Raw
In response to how to update table to make dup values distinct  (george young <gry@ll.mit.edu>)
List pgsql-sql
On Thu, Nov 10, 2005 at 10:58:18 -0500, george young <gry@ll.mit.edu> wrote:
> [PostgreSQL 7.4RC2 on i686-pc-linux-gnu](I know, I know... must upgrade soon)
> 
> I have a table mytable like:
>  i |  txt  
> ---+-------
>  1 | the
>  2 | the
>  3 | rain
>  4 | in
>  5 | mainly
>  6 | spain
>  7 | stays
>  8 | mainly
>  9 | in
> 
> I want to update it, adding a ':' to txt so that each txt value is unique.
> I don't care which entry gets changed.  I tried:

This seems like an odd way to fix whatever problem you are having.

Assuming you really do want to go through with this, you can use oids to
distinguish rows. For example you could add a colon to the row with the
lowest oid for each repeated string, and keep doing that until you have them
all fixed.


pgsql-sql by date:

Previous
From: "Joel Fradkin"
Date:
Subject: High level discussion for design of using ACL to retrieve Data
Next
From: "Gregory S. Williamson"
Date:
Subject: Re: Como ejecutar una funcion insert en plpgsql....