Re: data type change on a view
От | Scott Marlowe |
---|---|
Тема | Re: data type change on a view |
Дата | |
Msg-id | dcc563d10712121028n7564bdcdn1d2361fc91317f2b@mail.gmail.com обсуждение исходный текст |
Ответ на | data type change on a view ("A. Kretschmer" <andreas.kretschmer@schollglas.com>) |
Ответы |
Re: data type change on a view
|
Список | pgsql-general |
On Dec 12, 2007 12:11 PM, A. Kretschmer <andreas.kretschmer@schollglas.com> wrote: > Hello @all, > > i have a question (rot really for myself, a member of ther german forum > asks): > > i have two tables, contains a varchar(N)-column. Now i create a VIEW > based on this tables. The resulting view contains now a varchar without > length. How can i prevent this? How can i force that the column in the > view contains the *exact* typ? cast it to varchar(8): test=# create table h1 (t varchar(8)); CREATE TABLE test=*# create table h2 (t varchar(8)); CREATE TABLE test=*# create view h as select t::varchar(8) from h1 union all select t from h2; CREATE VIEW test=*# \d h View "public.h" Column | Type | Modifiers --------+-------------------+----------- t | character varying(8) | Note that I don't have to do that in 8.2.5, it's automagic...
В списке pgsql-general по дате отправления: