Re: How to determine the table a query or a views columns - Mailing list pgsql-general

From Chris
Subject Re: How to determine the table a query or a views columns
Date
Msg-id 440CEABD.8090109@gmail.com
Whole thread Raw
In response to Re: How to determine the table a query or a views columns come from?  (Frank Church <pgsql@adontendev.net>)
List pgsql-general
Frank Church wrote:
> Quoting Tom Lane <tgl@sss.pgh.pa.us>:
>
> Can this info be obtained by querying the system tables,
> especially in the case of views? I am using 'scripting' languages and using C
> will be quite awkward.
>
> I have got to find if libpq's output is exposed in PHP or Ruby.
>
>
>>Frank Church <pgsql@adontendev.net> writes:
>>
>>>Is there way to determine the table a query or a view's columns come from?
>>
>>Yeah, there's some support for that in the protocol.  libpq exposes it
>>as PQftable() and PQftablecol().

Do you need this?

test=# \d x
               View "public.x"
  Column |         Type          | Modifiers
--------+-----------------------+-----------
  name   | character varying(50) |
View definition:
  SELECT questions.name
    FROM questions;


If you need to see what query "\d x" is running, start psql with -E and
it will show it.

--
Postgresql & php tutorials
http://www.designmagick.com/

pgsql-general by date:

Previous
From: Chris
Date:
Subject: Re: Question about the contrib rpm ?
Next
From: Tom Lane
Date:
Subject: Re: problem with overloading the "coalesce" function