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@xxxxxxxxxxxx>
To: Michael Graham <mgraham@xxxxxxxxx>
Cc: "pgsql-general@xxxxxxxxxxxxxx" <pgsql-general@xxxxxxxxxxxxxx>
Sent: Friday, April 26, 2013 5:21 PM
Subject: Re: 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@xxxxxxxxxxxxxx)
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@xxxxxxxxxxxx>
To: Michael Graham <mgraham@xxxxxxxxx>
Cc: "pgsql-general@xxxxxxxxxxxxxx" <pgsql-general@xxxxxxxxxxxxxx>
Sent: Friday, April 26, 2013 5:21 PM
Subject: Re: 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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general