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 B274A329F0F for ; Wed, 15 Sep 2004 16:07:26 +0100 (BST) 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 67220-08 for ; Wed, 15 Sep 2004 15:07:23 +0000 (GMT) Received: from ucsns.ucs.co.za (ucs.co.za [196.23.43.2]) by svr1.postgresql.org (Postfix) with ESMTP id AFF4F329F01 for ; Wed, 15 Sep 2004 16:07:17 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by ucsns.ucs.co.za (Postfix) with ESMTP id D8C8B2BD84; Wed, 15 Sep 2004 17:06:54 +0200 (SAST) Received: from ucsns.ucs.co.za ([127.0.0.1]) by localhost (ucsns.ucs.co.za [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00783-01; Wed, 15 Sep 2004 17:06:45 +0200 (SAST) Received: from ucspost.ucs.co.za (mailgw1.ucs.co.za [196.23.43.253]) by ucsns.ucs.co.za (Postfix) with ESMTP id 0EAAE2BD70; Wed, 15 Sep 2004 17:06:45 +0200 (SAST) Received: from jhb.ucs.co.za (jhb.ucs.co.za [172.31.1.3]) by ucspost.ucs.co.za (Postfix) with ESMTP id D17E4DAEAA; Wed, 15 Sep 2004 17:07:10 +0200 (SAST) Received: from svb.ucs.co.za (svb.ucs.co.za [172.31.1.148]) by jhb.ucs.co.za (Postfix) with SMTP id 57662976CB; Wed, 15 Sep 2004 17:07:01 +0200 (SAST) Date: Wed, 15 Sep 2004 17:07:00 +0200 From: Stef To: Stef Cc: Andrew Sullivan , pgsql-sql@postgresql.org Subject: Re: Preserving column order when recreating table. Message-Id: <20040915170700.543722cf@svb.ucs.co.za> In-Reply-To: <20040915162201.13be5102@svb.ucs.co.za> References: <20040915142445.06b60e3e@svb.ucs.co.za> <20040915131930.GA28290@phlogiston.dyndns.org> <20040915162201.13be5102@svb.ucs.co.za> X-Mailer: Sylpheed-Claws 0.9.12 (GTK+ 1.2.10; i386-pc-linux-gnu) User-Agent: sillypheed-claws (anti-aliased) X-Face: GFoC95e6r)_TTG>n~=uFLojP=O~4W@Ms]>:.DMm/')(z3\Mwj^XP@? Q:3";lD.OM1"^mDu}2NJ@US:)dO:U*iY5EM50&Tx. X-Operating-System: sid X-X-X: _-^-_ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at ucs.co.za 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: 200409/109 X-Sequence-Number: 18955 Andrew mentioned : => Ugh. Sorry to say so, but this sounds to me really a lot like the => cure is worse than the disease. The answer to "Bob did something => incredibly stupid" is not "We'll bend ourselves into contortions to => support it." (This is not to say I don't sympathise. You wouldn't => believe how much I do.) Funny you say. It looks like "Bob" had a hand in pg_dump -d , 'cause I've many times wished there were column names specified there, too :) (I'm talking Prior 7.4 here, dunno if it's changed already) => and then rename the old table, rename the new table to the old table => name, and drop the old table if you like. The only problem I've run into now, is duplicate index names. I think this is why I didn't use this solution originally. But I figured out a way to modify pieces of the "create table" statement to drop all the indexes and constraints first. Is there an easier way around this? Stef