Hello
my solution isn't 100% perfect too. Better is test visibility:
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", r.rolname as "Owner"
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_roles r ON r.oid = c.relowner LEFT JOIN pg_catalog.pg_namespace n
ONn.oid = c.relnamespace
WHERE c.relkind IN ('r','') AND n.nspname <> 'pg_catalog' -- replace LIKE 'pg_temp%'; AND n.nspname !~ '^pg_toast' AND
pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;
for existence test this query can be simplified
Regards
Pavel Stehule
On 29/12/2007, Marcin Krawczyk <jankes.mk@gmail.com> wrote:
> I just realized something... my bad. It will work since TRUNCATE removes
> only table from current session.
>
> Thank you again.
> Regards
>
>