Re: All table names
| From: | Papp Gyozo | Date: | Thu, 25 Oct 2001 16:32:12 +0000 |
| Subject: | Re: All table names | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-431@lists.php.net to get a copy of this message | ||
Up to now psql (pgsql client) uses the query below to list all tables:
SELECT c.relname as "Name", 'table'::text as "Type", u.usename as
"Owner"
FROM pg_class c, pg_user u
WHERE c.relowner = u.usesysid AND c.relkind = 'r'
AND not exists (select 1 from pg_views where viewname = c.relname)
AND c.relname !~ '^pg_'
UNION
SELECT c.relname as "Name", 'table'::text as "Type", NULL as
"Owner"
FROM pg_class c
WHERE c.relkind = 'r'
AND not exists (select 1 from pg_views where viewname = c.relname)
AND not exists (select 1 from pg_user where usesysid = c.relowner)
AND c.relname !~ '^pg_'
it can be simplified since postgres now support any kind of JOIN:
SELECT c.relname As "Name"
FROM pg_class c LEFT JOIN pg_user u ON (c.relowner = u.usesysid)
WHERE c.relkind = 'r'
AND not exists (select 1 from pg_views where viewname = c.relname)
AND c.relname !~ '^pg_'
ORDER BY "Name";
I think the query used by developers mat be authoritative.
BTW, they are thinking of rewriting the queries sent by psql frontend
to the backend.
----- Original Message -----
From: "Tomas V.V.Cox" <cox@idecnet.com>
To: "Pablo DallOglio" <pablo@univates.br>; "Andrew M. Yochum"
<andrew@digitalpulp.com>
Cc: <cox@idecnet.com>; <pear-general@lists.php.net>; <jpm@phpbrasil.com>
Sent: Thursday, October 25, 2001 5:01 PM
Subject: Re: [PEAR] All table names
> On Thursday 25 October 2001 15:49, Pablo DallOglio wrote:
> > Now I still need to know table names on:
> >
> > FrontBase
> > InterBase
> > mssql
> > msql
> >
>
> Please could you send me the data you get? I'd be interested on adding
> this to Pear DB if you actually don't plan to contribute patches.
>
> Thanks,
>
> Tomas V.V.Cox
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, e-mail: pear-general-unsubscribe@lists.php.net
> For additional commands, e-mail: pear-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>