From: Tom Lane <tgl@sss.pgh.pa.us>
To: Traci Sumpter <Traci.Sumpter@opus.co.nz>
Cc: pgsql-sql@postgresql.org
Subject: Re: Defining Field Types with view
Date: Wed, 01 Sep 2004 18:41:25 -0400
Message-ID: <10958.1094078485@sss.pgh.pa.us> (raw)
In-Reply-To: <KFEJJKOAGCCGEJFLKCBBKEKPECAA.Traci.Sumpter@opus.co.nz>
References: <KFEJJKOAGCCGEJFLKCBBKEKPECAA.Traci.Sumpter@opus.co.nz>
"Traci Sumpter" <Traci.Sumpter@opus.co.nz> writes:
> Cheesy one here....
Got a cheesy answer for you --- cast the result ...
regression=# create view voo as
regression-# select f1::varchar(20) from
regression-# (select f1 from foo union select f2 from foo) ss;
CREATE VIEW
regression=# \d voo
View "public.voo"
Column | Type | Modifiers
--------+-----------------------+-----------
f1 | character varying(20) |
View definition:
SELECT ss.f1::character varying(20) AS f1
FROM ( SELECT foo.f1
FROM foo
UNION
SELECT foo.f2
FROM foo) ss;
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, Traci.Sumpter@opus.co.nz
Subject: Re: Defining Field Types with view
In-Reply-To: <10958.1094078485@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox