From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | george young <gry(at)ll(dot)mit(dot)edu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: how to update table to make dup values distinct |
Date: | 2005-11-11 05:05:41 |
Message-ID: | 20051111050541.GA22400@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, Nov 10, 2005 at 10:58:18 -0500,
george young <gry(at)ll(dot)mit(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory S. Williamson | 2005-11-11 10:24:37 | Re: Como ejecutar una funcion insert en plpgsql.... |
Previous Message | Michael Fuhr | 2005-11-10 21:30:09 | Re: time |