[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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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)

Attachment Content-Type Size
shdep-3.patch text/plain 42.6 KB
pg_shdepend.c text/plain 14.7 KB
pg_shdepend.h text/plain 2.1 KB

Responses

Browse pgsql-patches by date

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