[postgis-users] Any other way to use alias headers for fields?
andy at squeakycode.net
Mon Mar 26 07:21:37 PDT 2012
On 3/26/2012 4:32 AM, Robert Buckley wrote:
> I was just wondering if there is any other way in postgresql in which I
> could assign alias names to columns other than creating views and
> assigning the field names with the "AS" operator?
> I have shapefiles with column names which have cryptic titles. When I
> upload them into postgis and serve them in my viewer application, the
> original "cryptic" column names will be displayed. It would be nice to
> change them for the use in the viewer application but have the original
> names retained also to ensure that updates to the data can be done easier.
> postgis-users mailing list
> postgis-users at postgis.refractions.net
After import you could rename them if you want.
alter table x rename badname to newname;
How are you serving them? If you can write/modify the sql (as with
mapserver) you can do something like:
select badname as newname from x where newname = 'bob';
Why don't you like the view? I don't think you need the AS either.
This should work:
create view newx(newname) as select badname from x;
More information about the postgis-users