pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: george young <gry@ll.mit.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: how to update table to make dup values distinct
Date: Thu, 10 Nov 2005 23:05:41 -0600
Message-ID: <20051111050541.GA22400@wolff.to> (raw)
In-Reply-To: <20051110105818.4dc51e8c.gry@ll.mit.edu>
References: <20051110105818.4dc51e8c.gry@ll.mit.edu>

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.



view thread (3+ messages)  latest in thread

Message-ID: <20051111050541.GA22400@wolff.to>
Permalink:  ../20051111050541.GA22400@wolff.to/
Also on:    postgresql.org/message-id/20051111050541.GA22400@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, gry@ll.mit.edu
  Subject: Re: how to update table to make dup values distinct
  In-Reply-To: <20051111050541.GA22400@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox