Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id F0C8D9FB416 for ; Wed, 4 Oct 2006 13:20:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 76728-09 for ; Wed, 4 Oct 2006 16:20:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by postgresql.org (Postfix) with ESMTP id 367569FB38B for ; Wed, 4 Oct 2006 13:20:14 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so328756pyd for ; Wed, 04 Oct 2006 09:20:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=EBbJrQCNayPrrQJz7B/H3aLfTikGGECol+tVHKOd4Q0Y7wRhFe6wBFqYJB3aleX0iOaf16Q5SDZ7LHq6Rxkgv6Scxx0YItG8WQ9zaHCJL7vQHtUwci89HkChFkXxTjfYTuX1J5v/PEWVo3iqJ6gyoPXZaAaQ1dO005yMoSLhhVo= Received: by 10.35.72.6 with SMTP id z6mr1438800pyk; Wed, 04 Oct 2006 09:20:07 -0700 (PDT) Received: by 10.35.78.6 with HTTP; Wed, 4 Oct 2006 09:20:07 -0700 (PDT) Message-ID: Date: Wed, 4 Oct 2006 11:20:07 -0500 From: "Aaron Bono" To: "Erik Jones" Subject: Re: i have table Cc: "Markus Schaber" , pgsql-sql@postgresql.org In-Reply-To: <4523D51F.4070208@myemma.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_14967_12682028.1159978807363" References: <45237D6E.1030601@logix-tt.com> <4523C3E2.4010300@myemma.com> <4523D51F.4070208@myemma.com> X-Google-Sender-Auth: 73a20df7ae4bf1ef X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.574 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/43 X-Sequence-Number: 26432 ------=_Part_14967_12682028.1159978807363 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/4/06, Erik Jones wrote: > > 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 > > presently 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. So do it as needed and convert your application slowly. I just name my views as table_name_vw so all you have to do is modify your queries to hit the _vw instead of just the table. That shouldn't take much time to refactor. ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_14967_12682028.1159978807363 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/4/06, Erik Jones <erik@myemma.com> wrote:
Aaron Bono wrote:
> On 10/4/06, *Erik Jones* <erik@myemma.com <mailto:erik@myemma.com>>
> 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
>     presently 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.

 
So do it as needed and convert your application slowly.

I just name my views as table_name_vw so all you have to do is modify your queries to hit the _vw instead of just the table.  That shouldn't take much time to refactor.

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
================================================================== ------=_Part_14967_12682028.1159978807363--