Skip site navigation (1) Skip section navigation (2)

[WIP] The shared dependency patch

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: [WIP] The shared dependency patch
Date: 2004-12-16 01:57:55
Message-ID: 20041216015755.GB1492@dcc.uchile.cl (view raw or flat)
Thread:
Lists: pgsql-patches
Hackers,

Here is the current shared dependency patch I promised.  (The new files
are src/include/catalog/pg_shdepend.h and
src/backend/catalog/pg_shdepend.c).

The big problem with the current patch is this:

-- session 1
BEGIN;
DROP USER foo;
-- checks dependencies, all is OK
				-- session 2
				ALTER TABLE foo OWNER TO foo;
COMMIT;

Everything works, a dependency on user foo is recorded, but now it's
useless (it will be never checked).

Of course, there needs to be a lock to protect this from happening.  But
I'm not sure what should be locked.  The whole pg_shadow relation?  That
might be overkill.

I was trying to find out if I could lock the user (and have the ALTER
TABLE get a shared lock on the user before checking its existance, and
the DROP USER get an exclusive lock which would be release at
transaction end.  So everything would remain consistant.)  However the
LOCKTAG does not have provisions to lock arbitrary objects, only
relations (I could end up locking some completely unrelated table, I
guess).

Any ideas on how to handle this?

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Aprende a avergonzarte más ante ti que ante los demás" (Demócrito)

Responses

pgsql-patches by date

Next:From: Ioseph KimDate: 2004-12-16 04:04:33
Subject: update korean po messages
Previous:From: Bruce MomjianDate: 2004-12-15 17:55:06
Subject: Re: Threading fix for AIX

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group