X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E0AF8DB2DD for ; Fri, 11 Nov 2005 01:03:02 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15818-02 for ; Fri, 11 Nov 2005 05:03:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 2AA57DADB5 for ; Fri, 11 Nov 2005 01:02:58 -0400 (AST) Received: (qmail 22899 invoked by uid 500); 11 Nov 2005 05:05:41 -0000 Date: Thu, 10 Nov 2005 23:05:41 -0600 From: Bruno Wolff III To: george young Cc: pgsql-sql@postgresql.org Subject: Re: how to update table to make dup values distinct Message-ID: <20051111050541.GA22400@wolff.to> Mail-Followup-To: Bruno Wolff III , george young , pgsql-sql@postgresql.org References: <20051110105818.4dc51e8c.gry@ll.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051110105818.4dc51e8c.gry@ll.mit.edu> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/100 X-Sequence-Number: 23351 On Thu, Nov 10, 2005 at 10:58:18 -0500, george young 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.