Hi all,
I'm trying to create a table that contains only valid table names. I'm
currently using reglass for the field type which works fine for when you
are adding to the table (i.e. you can't add invalid tablesnames to the
table). But it is still possible to leave the table in an invalid state
after doing a drop table.
So for example:
=> CREATE TABLE table_list (tablename regclass);
CREATE TABLE
=> INSERT INTO table_list VALUES ('foo');
ERROR: relation "foo" does not exist
LINE 1: INSERT INTO table_list VALUES ('foo');
^
=> CREATE TABLE foo (a int);
CREATE TABLE
=> INSERT INTO table_list VALUES ('foo');
INSERT 0 1
=> DROP TABLE foo;
DROP TABLE
=> SELECT * FROM table_list;
tablename
-----------
122860
(1 row)
Does any one have any ideas that could be used to stop this from
happening? I'm not really in the position to have different users for
the modification of the table_list and the drops so I don't think I can
use different roles.
I'm pretty sure I can't do what I need as postgres doesn't support
triggers on DDL but maybe I'm wrong.
Cheers,
--
Michael Graham
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general