Re: How to determine the table a query or a views columns

From: Chris <dmagick(at)gmail(dot)com>
To: Frank Church <pgsql(at)adontendev(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to determine the table a query or a views columns
Date: 2006-03-07 02:06:53
Message-ID: 440CEABD.8090109@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Frank Church wrote:
> Quoting Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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(at)adontendev(dot)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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-03-07 02:39:18 Re: problem with overloading the "coalesce" function
Previous Message Chris 2006-03-07 02:00:26 Re: Question about the contrib rpm ?