Re: Can column name aliases be supported? - Mailing list pgsql-general

From Gauthier, Dave
Subject Re: Can column name aliases be supported?
Date
Msg-id 0AD01C53605506449BA127FB8B99E5E11802BF0F@FMSMSX105.amr.corp.intel.com
Whole thread Raw
In response to Re: Can column name aliases be supported?  (Chris Angelico <rosuav@gmail.com>)
Responses Re: Can column name aliases be supported?
List pgsql-general
Thanks for all the replies !

The real problem has nothing to do with names.  I just used that as a vehicle for articulating the problem.

The view approach for queries is workable, at least for queries.  Thanks for the input on that and the idea to
replicatethe various aliases in the view! 

I take it that duplication of the aliases as formal table columns, synched up with a before trigger is a bad idea?  Is
thereany fruit on the end of that branch? (after looking at RULES, I expect only a single dried raisin :-)) 

Regarding the RULES approach, I've never used RULES before, so please bear with me a bit :-)
My stab at this using the base example...

create rule lastnamealias1
on update PEOPLE.lname
do instead update PEOPLE.last_name;

create rule lastnamealias2
on update PEOPLE.surname
do instead update PEOPLE.last_name;

does that look correct (given that last_name is the actual c olumn name)?


I too would like to shoot the clients.  But as they say, the customer is always right !

Thanks Again everyone !


-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Chris Angelico
Sent: Thursday, August 23, 2012 1:23 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Can column name aliases be supported?

On Thu, Aug 23, 2012 at 2:19 PM, Craig Ringer <ringerc@ringerc.id.au> wrote:
> On 08/23/2012 11:56 AM, Chris Angelico wrote:
>>
>> Here's an out-of-the-box suggestion.
>>
>> Drop the column altogether and have a single column "name". Trying to
>> divide names up never works properly. Does "surname" mean family name?
>> Not all cultures put the family name last. Is "last_name" simply the
>> part of the name after the last space?
>
> +1 to that, and it gets way worse:
>
> http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-abo
> ut-names/

Yes, that link was posted on python-list a little while back, and that's what I had in mind as I was writing that up.
Couldn'tremember the actual link though. Thanks! 

> and while you're at it, read this:
>
> http://www.joelonsoftware.com/articles/Unicode.html

Definitely. I disagree with Joel Spolsky on many things, but I agree with that post. These days, Unicode is an absolute
necessity.Our PHP-based web site has a number of issues with Unicode input, but at least everything that goes through
thedatabase (we use Postgres for 
everything) is safe.

ChrisA


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: Jasen Betts
Date:
Subject: Re: At what point does a big table start becoming too big?
Next
From: Bill Moran
Date:
Subject: Re: At what point does a big table start becoming too big?