Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id CB00B9FB68F for ; Wed, 6 Jun 2007 12:22:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 31326-09 for ; Wed, 6 Jun 2007 12:22:29 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id 79D739FB666 for ; Wed, 6 Jun 2007 12:22:29 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.8/8.13.8) with ESMTP id l56FMKJh083030 for ; Wed, 6 Jun 2007 12:22:20 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.8/8.13.8/Submit) id l56FLeKh082167 for pgsql-admin@postgresql.org; Wed, 6 Jun 2007 12:21:40 -0300 (ADT) (envelope-from news) From: Erwin Brandstetter X-Newsgroups: pgsql.admin Subject: Re: Change order of table-columns in pg_catalog.pg_attribute.attnum Date: Wed, 06 Jun 2007 08:21:48 -0700 Organization: http://groups.google.com Lines: 24 Message-ID: <1181143308.525613.238500@q75g2000hsh.googlegroups.com> References: <1181138388.508384.51110@q75g2000hsh.googlegroups.com> <20070606143852.GF6377@alvh.no-ip.org> <21001.1181141959@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Complaints-To: groups-abuse@google.com In-Reply-To: <21001.1181141959@sss.pgh.pa.us> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: q75g2000hsh.googlegroups.com; posting-host=62.116.9.170; posting-account=motVOw0AAAAl5BtLWL3QN4EcB1CKG8U3 To: pgsql-admin@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/41 X-Sequence-Number: 25709 On Jun 6, 4:59 pm, t...@sss.pgh.pa.us (Tom Lane) wrote: > Alvaro Herrera writes: > > Erwin Brandstetter escribi=F3: > >> If I want to change the default order of two columns of a table, can I > >> just manipulate the values in > >> pg_catalog.pg_attribute.attnum? > > It works -- as long as the table is empty. > > And as long as you have no views, foreign keys, indexes, defaults, > rules, etc etc etc referencing the columns. > > Short answer is don't even think of trying it. Thanks for your answers. I had tried it with data in the table and it seemed to work, but it does mess up views referencing the table. So, no go. The only way to change the default order of columns is still to drop the table and all references to it and recreate it all? Regards Erwin