Search Postgresql Archives

Re: Can column name aliases be supported?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 replicate the 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 there any 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@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Chris Angelico
Sent: Thursday, August 23, 2012 1:23 AM
To: pgsql-general@xxxxxxxxxxxxxx
Subject: Re:  Can column name aliases be supported?

On Thu, Aug 23, 2012 at 2:19 PM, Craig Ringer <ringerc@xxxxxxxxxxxxx> 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't remember 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 the database (we use Postgres for
everything) is safe.

ChrisA


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


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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux