psql listTables

Поиск
Список
Период
Сортировка
Искать

psql listTables

От:
Thomas F.O'Connell <tfo@sitening.com>
Дата:
In examining the output of psql -E to get some templates for some 
queries I'm developing, I noticed in describe.c that there is logic to 
inform the final IN clause that gets printed for relkind but no similar 
logic for the CASE clause.

Here's what I get from a \d in 7.4.1:

SELECT n.nspname as "Schema", c.relname as "Name",CASE c.relkind	WHEN 'r' THEN 'table'	WHEN 'v' THEN 'view'	WHEN 'i' THEN 'index'	WHEN 'S' THEN 'sequence'	WHEN 's' THEN 'special'END as "Type",
u.usename as "Owner"
FROM pg_catalog.pg_class c     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','v','S','')      AND n.nspname NOT IN ('pg_catalog', 'pg_toast')      AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;

Such that the IN clause for c.relkind seems to preclude two of the 
options ('i' and 's') in the CASE.

I realize this is a trivial issue, but it seems like logic could be 
added to the CASE statement to prevent irrelevant SELECT material from 
being output.

Couldn't the SELECT clause include if(showTables), etc.?

-tfo


Re: psql listTables

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Thomas F.O'Connell"  writes:
> I realize this is a trivial issue, but it seems like logic could be 
> added to the CASE statement to prevent irrelevant SELECT material from 
> being output.

Hardly seems worth the trouble ...
		regards, tom lane

Re: psql listTables

От:
Thomas F.O'Connell <tfo@sitening.com>
Дата:
I know, but I don't get too many opportunities to contribute... :)

Just figured I'd mention it.

-tfo

On Jul 23, 2004, at 4:06 PM, Tom Lane wrote:

> "Thomas F.O'Connell"  writes:
>> I realize this is a trivial issue, but it seems like logic could be
>> added to the CASE statement to prevent irrelevant SELECT material from
>> being output.
>
> Hardly seems worth the trouble ...
>
> 			regards, tom lane


FAQ