Thread: How to Examine a view

How to Examine a view

From
info@axier.se
Date:
I have setup a view consisting of two tables and some compound fields.
Now I would like from the client perspective see what those compound
fields actually are originally.

Let's (for simplicity I have inlcuded only one table) say we have:
CREATE OR REPLACE VIEW clientview AS
 SELECT c.clientid, (c.orderer_name::text || ' :'::text) ||
substr(c.occasion::text, 1, 10) AS "Order occasion", c.customerid
   FROM client c

Is it possible to query postgres to tell me what field names and field
types "Order occasion" really consists of?


Re: How to Examine a view

From
Ray Stell
Date:
is this what you mean?

testdb=# \d foo_view
           View "public.foo_view"
 Column |         Type          | Modifiers
--------+-----------------------+-----------
 x      | character varying(20) |
 stuff  | text                  |
 y      | character varying(20) |
View definition:
 SELECT a.x, (a.x::text || ' :'::text) || substr(b.y::text, 1, 10) AS stuff, b.y   FROM foo1 a, foo2 b;









On Mon, Sep 25, 2006 at 08:44:33AM -0700, info@axier.se wrote:
> I have setup a view consisting of two tables and some compound fields.
> Now I would like from the client perspective see what those compound
> fields actually are originally.
>
> Let's (for simplicity I have inlcuded only one table) say we have:
> CREATE OR REPLACE VIEW clientview AS
>  SELECT c.clientid, (c.orderer_name::text || ' :'::text) ||
> substr(c.occasion::text, 1, 10) AS "Order occasion", c.customerid
>    FROM client c
>
> Is it possible to query postgres to tell me what field names and field
> types "Order occasion" really consists of?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match

--