data type change on a view

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: data type change on a view
Date: 2007-12-12 18:11:46
Message-ID: 20071212181146.GB17415@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

Example:

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 from h1 union all select t from h2;
CREATE VIEW
test=*# \d h
View "public.h"
Column | Type | Modifiers
--------+-------------------+-----------
t | character varying |

thx, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Samantha Atkins 2007-12-12 18:12:37 Re: what is the date format in binary query results
Previous Message Scott Marlowe 2007-12-12 18:09:35 Re: very slow query