Re: Table containing only valid table names

From: salah jubeh <s_jubeh(at)yahoo(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>, Michael Graham <mgraham(at)bloxx(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Table containing only valid table names
Date: 2013-04-26 16:08:11
Message-ID: 1366992491.9771.YahooMailNeo@web122203.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)archonet(dot)com>
To: Michael Graham <mgraham(at)bloxx(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Perry Smith 2013-04-26 16:30:19 NOTIFY channel
Previous Message Tom Lane 2013-04-26 15:25:41 Re: is there a way to deliver an array over column from a query window?