Re: temp table existence - Mailing list pgsql-sql

From Pavel Stehule
Subject Re: temp table existence
Date
Msg-id 162867790712291323m2d7212e9i6e85d7b128e9dc1c@mail.gmail.com
Whole thread Raw
In response to Re: temp table existence  ("Marcin Krawczyk" <jankes.mk@gmail.com>)
List pgsql-sql
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
>
>


pgsql-sql by date:

Previous
From: "Marcin Krawczyk"
Date:
Subject: Re: temp table existence
Next
From: aklaver@comcast.net (Adrian Klaver)
Date:
Subject: Re: temp table existence