Re: Table containing only valid table names
От | salah jubeh |
---|---|
Тема | Re: Table containing only valid table names |
Дата | |
Msg-id | 1366992491.9771.YahooMailNeo@web122203.mail.ne1.yahoo.com обсуждение исходный текст |
Ответ на | Re: Table containing only valid table names (Richard Huxton <dev@archonet.com>) |
Список | 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
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
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 по дате отправления: