Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 343D29FA8EF for ; Thu, 5 Oct 2006 04:33:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 57178-05 for ; Thu, 5 Oct 2006 04:32:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from matrix.gatewaynet.com (host2.dynacom.ondsl.gr [62.103.35.210]) by postgresql.org (Postfix) with ESMTP id 528929FA50F for ; Thu, 5 Oct 2006 04:32:59 -0300 (ADT) Received: from host3.dynacom.ondsl.gr ([62.103.35.211] helo=ip216.internal.net) by matrix.gatewaynet.com with esmtp (Exim 4.62) (envelope-from ) id 1GVNix-0007Po-Sy for pgsql-sql@postgresql.org; Thu, 05 Oct 2006 10:32:55 +0300 From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: pgsql-sql@postgresql.org Subject: Re: i have table Date: Thu, 5 Oct 2006 10:32:55 +0300 User-Agent: KMail/1.9.3 References: <4523D51F.4070208@myemma.com> In-Reply-To: <4523D51F.4070208@myemma.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200610051032.55610.achill@matrix.gatewaynet.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.163 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/56 X-Sequence-Number: 26445 =CE=A3=CF=84=CE=B9=CF=82 =CE=A4=CE=B5=CF=84=CE=AC=CF=81=CF=84=CE=B7 04 =CE= =9F=CE=BA=CF=84=CF=8E=CE=B2=CF=81=CE=B9=CE=BF=CF=82 2006 18:37, =CE=BF/=CE= =B7 Erik Jones =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > Aaron Bono wrote: > > On 10/4/06, *Erik Jones* > > > wrote: > > > > There is one non-SQL related reason that I like to be able to order > > columns, at least the way they are displayed whenever the table is > > described: human comprehension. For example, I like to group all > > keys > > in a table before data, that includes primary as well as foreign > > keys. > > So, say I'm building on to an existing application and I need to do > > an ALTER TABLE on an existing table to add a foreign key to an existing > > table. I'd like that key to be listed with the other keys, but present= ly > > that's not possible in a simple way and, to be honest, I usually just go > > without as the process you've described below is too prone to user > > (human) error when dealing with live, sensitive data for me to want to > > mess with it. > > > > > > Ah, but it is possible... if you use views. > > > > I recommend you build views and query off them. Then you can control > > the order the columns will appear. > > Which would be great if I didn't have (many) thousands of lines of code > that already use the tables. Besides, this is no where near a 'make or > break' thing. It's just a matter of aesthetic preference. Alright, you could play with something like: UPDATE pg_attribute SET attnum =3D where=20 attrelid=3D and attname=3D''; but do some research of possible bad side effects. =2D-=20 Achilleas Mantzios