Re: Referencing columns from system tables possible?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Referencing columns from system tables possible?
Дата
Msg-id 20031108032533.GC2225@dcc.uchile.cl
обсуждение исходный текст
Ответ на Referencing columns from system tables possible?  (Boris Popov <boris@procedium.com>)
Ответы Re: Referencing columns from system tables possible?  (Boris Popov <boris@procedium.com>)
Список pgsql-general
On Fri, Nov 07, 2003 at 06:20:32PM -0800, Boris Popov wrote:

> CREATE TABLE sessions (
>  id serial PRIMARY KEY,
>  procpid int4 REFERENCES pg_listener(listenerpid) ON DELETE CASCADE
>  );
>
> I get a warning saying 'relation "pg_listener" is a system catalog'
>
> Is it unreasonable and/or impossible to do this?

IMHO it's both.  It's impossible because system catalogs don't have
trigger checking and other stuff, so you can't really have foreign
keys.  To do so would make the whole system much slower.

It's also unreasonable because you shouldn't be relying on such a
system-specific way of representing user data.  I remember what you were
trying to achieve; I don't have any ideas to give to you, but I can tell
you this is not what you are looking for.

(I don't remember why you rejected the idea of having a cron job to
delete entries belonging to expired sessions ...)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Los dioses no protegen a los insensatos.  Éstos reciben protección de
otros insensatos mejor dotados" (Luis Wu, Mundo Anillo)

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

Предыдущее
От: Boris Popov
Дата:
Сообщение: Referencing columns from system tables possible?
Следующее
От: Boris Popov
Дата:
Сообщение: Re: Referencing columns from system tables possible?