Re: Can column name aliases be supported?

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Can column name aliases be supported?
Date: 2012-08-22 22:35:54
Message-ID: 50355ECA.6020905@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/22/2012 04:19 PM, Gauthier, Dave wrote:
> Here's the problem....
>
> I have a table with a column called "last_name". I have one customer
> who likes to articulate queries and updates for this using column name
> "last_name" (no problem there) but another who likes to call it "lname"
> and yet another who likes to call it "surname". So 3 different names
> for the same physical column in the table.
>
> I know a view can be used to alias one of them. But what about the other
> 2? Three views (or 2 views and the main table) is awkward. Also, you
> can't modify the data through a view.
>
> I thought of having a table with the 3 column names in there
> "last_name", "lname" and "surname". The queries should work fine. As
> for the updates and inserts, have a before trigger make sure they're
> all synched up. But that only works if only one of the value changes,
> otherwise how do you know which one to sync up to! Hmmmm.....
>
> Does anyone know of an elegant way to do this?
>
> Thanks in Advance
>
What environment lets the customer articulate queries using apparently
random choices for column names?

If the customers are seeing (in their client-side vision) their
"flavour" of column name, the same magic presenting that flavour might
then be responsible for deconvolving same?

Else some nasty per client sed scripts are in your future :)

rjs

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bosco Rama 2012-08-22 22:41:12 Re: Can column name aliases be supported?
Previous Message Bosco Rama 2012-08-22 22:34:50 Re: Can column name aliases be supported?