Table containing only valid table names

Поиск
Список
Период
Сортировка
От Michael Graham
Тема Table containing only valid table names
Дата
Msg-id 517A98B8.4090000@bloxx.com
обсуждение исходный текст
Ответы Re: Table containing only valid table names
Список pgsql-general
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



В списке pgsql-general по дате отправления:

Предыдущее
От: Rowan Collins
Дата:
Сообщение: UPDATE using 3 medium-sized tables causes runaway hash table and fills disk
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Checking for changes in other tables