Tricky query, tricky response
От | Peter Eisentraut |
---|---|
Тема | Tricky query, tricky response |
Дата | |
Msg-id | Pine.LNX.4.10.9910010253310.625-100000@peter-e.yi.org обсуждение исходный текст |
Ответы |
Re: [HACKERS] Tricky query, tricky response
|
Список | pgsql-hackers |
As you might recognize, this is supposed to be a psql \d imitation in one shot: SELECT usename as "Owner", relname as "Relation", (CASE WHEN relkind='r' THEN (CASE WHEN 0<(select count(*) from pg_views where viewname = relname)THEN 'view' ELSE 'table'END) WHEN relkind='i' THEN 'index' WHEN relkind='S' THEN 'sequence' ELSE 'other' END) as "Type" FROM pg_class, pg_user WHERE usesysid = relowner AND ( relkind = 'r' OR relkind = 'i' OR relkind = 'S') AND relname !~ '^pg_' AND (relkind != 'i' OR relname !~ '^xinx') ORDER BY relname; ERROR: flatten_tlistentry: Cannot handle node type 108 However, if you do - (CASE WHEN 0<(select count(*) from pg_views where viewname = relname) - THEN 'view' ELSE 'table' END) + 'relation' if works fine. No nested CASE's? PostgreSQL 6.5.2 on i586-pc-linux-gnu, compiled by egcs -- Peter Eisentraut - peter_e@gmx.net http://yi.org/peter-e
В списке pgsql-hackers по дате отправления: