X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1D29DD1B4E5 for ; Fri, 25 Jun 2004 05:37:57 -0300 (ADT) 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 65454-08 for ; Fri, 25 Jun 2004 08:37:56 +0000 (GMT) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by svr1.postgresql.org (Postfix) with ESMTP id 1B766D1B38E for ; Fri, 25 Jun 2004 05:37:53 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 1BdmDb-000FJ9-0U; Fri, 25 Jun 2004 09:37:55 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 229C5167B6; Fri, 25 Jun 2004 09:37:54 +0100 (BST) Message-ID: <40DBE463.7060308@archonet.com> Date: Fri, 25 Jun 2004 09:37:55 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.7 (X11/20040615) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Graham Leggett Cc: Frank Bax , pgsql-sql@postgresql.org Subject: Re: Normalising an existing table - how? References: <5.2.1.1.0.20040624170431.04384a70@pop6.sympatico.ca> <40DB4B64.5080101@sharp.fm> In-Reply-To: <40DB4B64.5080101@sharp.fm> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/253 X-Sequence-Number: 18198 Graham Leggett wrote: > Frank Bax wrote: > >> Do all three steps in one command: >> >> create table newtable as (select key1, key2, money from oldtable); > > > How would I put the primary key of each row in newtable back into > oldtable? Also, newtable already exists and contains data - I need to > add normalised data to an already partially normalised database. How can newtable contain data if you don't have any keys for it? Perhaps a fuller example, with the schemas of the tables in question would help. -- Richard Huxton Archonet Ltd