Re: Redefining a column within a view

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Redefining a column within a view
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B057B6BE3@ntex2010a.host.magwien.gv.at
обсуждение исходный текст
Ответ на Redefining a column within a view  ("Schade, Jeffrey" <JSchade@iso.com>)
Ответы Re: Redefining a column within a view  ("Schade, Jeffrey" <JSchade@iso.com>)
Список pgsql-general
Jeffrey Schade wrote:
> We have a table which contains a 3 byte column with datatype CHAR(3) whic=
h we want to redefine within
> the view as a CHAR(1) column and a CHAR(2) column. When I code the SUBSTR=
 function the resulting
> column datatype is TEXT. I would like to see the CHAR datatype, is there =
anything I can do to set the
> proper datatype. The sample view is below:
>=20
> CREATE OR REPLACE VIEW schema.jeff_view AS
>  SELECT col1 ,
>                 col2,
>                 Substr(col3,1,1) as col3_part1,
>                 Substr(col3,2)     as col3_part2,
>                 col4
>   FROM schema.jeff_table;

Try:
[...]
                 Substr(col3,1,1)::char(1) as col3_part1,
                 Substr(col3,2)::char(2)   as col3_part2,
[...]

Yours,
Laurenz Albe

В списке pgsql-general по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: PostgreSQL binaries under /usr/lib, why?
Следующее
От: "Schade, Jeffrey"
Дата:
Сообщение: Re: Redefining a column within a view