column aliases?

Started by Gauthier, Daveover 16 years ago2 messagesgeneral
Jump to latest
#1Gauthier, Dave
dave.gauthier@intel.com

Hi:

Does PG support the notion of a colum alias? I'm not talking about "select foo as fii....", I'm thinking more along the lines of supporting 2 different names for the same column. For example, a tablle has a column named "social_security_number". Queries may ask for this column as defined ("social_security_number") but some may ask for is using "ssn".

Is there a way to assign 2 different names for the same column to support a situation like above?

I was thinking that a view might do this, but is not a direct table query. It's also not editable.

Thanks for any help !!!

#2Richard Broersma
richard.broersma@gmail.com
In reply to: Gauthier, Dave (#1)
Re: column aliases?

On Fri, Nov 13, 2009 at 6:33 AM, Gauthier, Dave <dave.gauthier@intel.com> wrote:

Does PG support the notion of a colum alias?

No, the closest thing would be alias names from a VIEW.

Is there a way to assign 2 different names for the same column to support a
situation like above?

No.

I was thinking that a view might do this, but is not a direct table query.
It’s also not editable.

you can make your view editable fairly easily by implementing rules.
However, there is a limitation with rules in the case of multiple
record modifications.

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug