Re: best way to reference tables

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: best way to reference tables
Дата
Msg-id 42F8C3AE.50903@archonet.com
обсуждение исходный текст
Ответ на best way to reference tables  (TJ O'Donnell <tjo@acm.org>)
Ответы Re: best way to reference tables  ("TJ O'Donnell" <tjo@acm.org>)
Список pgsql-general
TJ O'Donnell wrote:
> I have many different tables that I want to keep track of.
> So, I thought of a master table with those table names in it.
> But, to maintain this (suppose a table changes
> its name, gets dropped) I want to have some kind of referential
> integrity - the way foreign keys and constraints do.
> What could I use that would disallow inserting a name into
> the master table unless another table by that name already exists?
> And what could ensure that a table would not be renamed or dropped
> unless the master table is changed?

You can write your own triggers that would stop you from adding a
non-existent table to your master-table. You can't fire triggers on
changes to system tables though, so you can't stop someone adding a table.

In any case, you presumably want to track ALTER TABLE ADD COLUMN too so
you'll need something a little smarter.

Have you considered "pg_dump --schema-only" along with suitable
version-control software (CVS/Subversion/Arch etc)? Or are you trying to
track something specific?

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Database syncronization
Следующее
От: Csaba Nagy
Дата:
Сообщение: Re: Query stucked in pg_stat_activity