Defining Field Types with view

From: "Traci Sumpter" <Traci(dot)Sumpter(at)opus(dot)co(dot)nz>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Defining Field Types with view
Date: 2004-09-01 20:27:14
Message-ID: KFEJJKOAGCCGEJFLKCBBKEKPECAA.Traci.Sumpter@opus.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Cheesy one here....

I created a view similar to

Select field1, field2 from table
where field3 = 'Fred'
UNION
Select field1, field2 from table
where field3 = 'Wilma';

When the view contains just one sql statement the field definitions e.g.
charater varying (20) however when both are in the fields turn into
character varying (no size).

this is causing a problem when referring to the fields within Dephi/VB
because they think the varchar fields are memo.

I have got around it by creating another view which selects
field1::varchar(100) , field2 varchar(50) from firstview.

I have tried casting the fields within the first view but to no sucess.

Any way to get over this???

Cheers

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-09-01 22:41:25 Re: Defining Field Types with view
Previous Message Thomas F.O'Connell 2004-09-01 16:28:12 Re: Extracting fieldnames from a TABLE