Search Postgresql Archives

Re: lowercase on columnname using view

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

 



On Tue, 2012-05-08 at 04:00 -0700, Chrishelring wrote:
> Hi all,
> 
> had some help the other day, but now I´m kinda stuck again. :/
> 
> I have a table ("virksomhedsdata") with the following columns:
> 
> "MI_STYLE" character varying(254),
>  "MI_PRINX" integer NOT NULL DEFAULT
> nextval('rk_ois."virksomhedsdata_MI_PRINX_seq"'::regclass),
>  "SP_GEOMETRY" geometry,
> 
> I would like to make a view so that the columnnames are presented in
> lowercase. I thought that the following would work:
> 
> CREATE OR REPLACE VIEW rk_ois.virksomhedsdata AS 
>  SELECT  virksomhedsdata.MI_STYLE AS mi_style, virksomhedsdata.MI_PRINX as
> mi_prinx, virksomhedsdata.SP_GEOMETRY AS sp_geometry
>    FROM rk_ois.virksomhedsdata;
> 
> But it fails saying that column virksomhedsdata.mi_style does not exist.
> 
> What am I doing wrong here?
> 

You should double-quote the columns of the table. Something like this:

CREATE OR REPLACE VIEW rk_ois.virksomhedsdata AS 
  SELECT  virksomhedsdata."MI_STYLE" AS mi_style, ...


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com


-- 
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