Re: How can I find the schema that a table belongs to?

From: DM <dm(dot)aeqa(at)gmail(dot)com>
To: jerry(dot)levan(at)mac(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How can I find the schema that a table belongs to?
Date: 2011-01-19 20:12:10
Message-ID: AANLkTinXOWaYhGU7y4aYWgKnVBGWWP4MHoo_2djLD8bB@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

one of the way to find out schema name is like below

select * from pg_tables where tablename like '%xyz%';
schemaname | tablename | tableowner | tablespace | hasindexes | hasrules |
hastriggers
------------+-----------+------------+------------+------------+----------+-------------
(0 rows)

~Deepak

On Wed, Jan 19, 2011 at 8:26 AM, Jerry LeVan <jerry(dot)levan(at)mac(dot)com> wrote:

> Hi,
>
> I am trying to tidy up my perl script that runs as a cgi and allows
> remote users (aka me) to interact with my Pg database.
>
> I primarily want to use this tool as a way for my iPad to
> browse my data base. It seems to be working quite well but
> one certainly does not want to 'select * from ginormous_table'.
>
> I am trying to build a 'describe' function. ie if the user
> types "describe tablename" in the sql box I want to display
> some interesting attributes for that table, mainly names and
> data types for each of the columns.
>
> I have done this in other programs but I forced the user
> to specify a schema qualified name ( and mimiced what psql -E
> did).
>
> So I guess the question is:
> Given a bare table name, how can I recover the schema
> qualified name with whatever the current search path happens
> to be?
>
> This task has to be done using simple sql from the perl dbi.
>
> Thanks,
>
> Jerry
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2011-01-19 20:29:11 Re: How can I find a schema that a table belong to?
Previous Message Ahmed Ossama 2011-01-19 20:00:06 Re: Error during a dump (ts_selectivity, not found)