From: Pavel Stehule <pavel.stehule@gmail.com>
To: Marcin Krawczyk <jankes.mk@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: temp table existence
Date: Sat, 29 Dec 2007 22:23:51 +0100
Message-ID: <162867790712291323m2d7212e9i6e85d7b128e9dc1c@mail.gmail.com> (raw)
In-Reply-To: <95f6bf9b0712291316x31ae9c8er80fb60a7db4aaca6@mail.gmail.com>
References: <95f6bf9b0712291116lc3c1df0o978922176e98f8d7@mail.gmail.com>
<162867790712291133n1bb6a6fcqeb1234df1576dd8c@mail.gmail.com>
<95f6bf9b0712291316x31ae9c8er80fb60a7db4aaca6@mail.gmail.com>
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 ON n.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
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: pavel.stehule@gmail.com, jankes.mk@gmail.com
Subject: Re: temp table existence
In-Reply-To: <162867790712291323m2d7212e9i6e85d7b128e9dc1c@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox