Re: Referencing columns from system tables possible?

From: Boris Popov <boris(at)procedium(dot)com>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Referencing columns from system tables possible?
Date: 2003-11-08 03:33:47
Message-ID: 82382580942.20031107193347@procedium.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Alvaro,

Friday, November 7, 2003, 7:25:33 PM, you wrote:

AH> 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?

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

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

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

Reason I'm trying to find a different solution is to avoid
implementing application heartbeat that updates the timestamp. On one
hand interval value has to be low to keep the system as close as
possible to real-time, yet it has to be rare enough to avoid
unnessecary load. If there was some way I could beat the backend into
maintaining the list automatically it'd be so much greater. It does it
already in pg_listener, this can't be hard to make available to
general public.

--
-Boris

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Edwin Quijada 2003-11-08 06:04:07 Re: Recovery Data Cant Be!!!
Previous Message Alvaro Herrera 2003-11-08 03:25:33 Re: Referencing columns from system tables possible?