Re: Table containing only valid table names - Mailing list pgsql-general

From salah jubeh
Subject Re: Table containing only valid table names
Date
Msg-id 1366992491.9771.YahooMailNeo@web122203.mail.ne1.yahoo.com
Whole thread Raw
In response to Re: Table containing only valid table names  (Richard Huxton <dev@archonet.com>)
List pgsql-general
Hello,

You can have the list of table names  from pg_class  such as

SELECT c.relname as "Name" ,
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r') AND n.nspname NOT IN  ('pg_toast', 'pg_catalog', 'information_schema') ;

So, if you want to store all table names you can just create a view around the  above query.

Also , the following is not a perfect solution;  but I think it will work.  You can join your table with pg_class to filter out tables which are Dropped

Regards


From: Richard Huxton <dev@archonet.com>
To: Michael Graham <mgraham@bloxx.com>
Cc: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
Sent: Friday, April 26, 2013 5:21 PM
Subject: Re: [GENERAL] Table containing only valid table names

On 26/04/13 16:09, Michael Graham wrote:
> I'm pretty sure I can't do what I need as postgres doesn't support
> triggers on DDL but maybe I'm wrong.

If you're still in development and not live, it'll be worth checking out 9.3

http://www.postgresql.org/docs/devel/static/event-triggers.html


--
  Richard Huxton
  Archonet Ltd


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: is there a way to deliver an array over column from a query window?
Next
From: Perry Smith
Date:
Subject: NOTIFY channel