Re: Problems with ALTER DOMAIN patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rod Taylor <rbt(at)rbt(dot)ca>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problems with ALTER DOMAIN patch
Date: 2002-12-11 03:56:56
Message-ID: 8491.1039579016@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Rod Taylor <rbt(at)rbt(dot)ca> writes:
>> 2. Insufficient locking, guise 2: there's no protection against someone
>> else adding a column or table while you're processing an ALTER DOMAIN,
>> either. This means that constraint checks will be missed. Example:

> Locking the entry in pg_type doesn't prevent that?

If there were such a thing as "locking the entry in pg_type", it might
prevent that, but (a) there isn't, and (b) your code wouldn't invoke it
if there were. Reading a row should surely not be tantamount to
invoking an exclusive lock on it.

In any case, other backends might have the pg_type entry in their
syscaches, in which case their references to the type would be quite
free of any actual read of the pg_type row that might fall foul of
your hypothetical lock.

To make this work in a reliable way, there needs to be some concept
of acquiring a lock on the type as an entity, in the same way that
LockRelation acquires a lock on a relation as an entity --- which has
only the loosest possible connection to the notion of a lock on the
relation's pg_class row. We have no such locks on types at present,
but I think it may be time to invent 'em.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-12-11 04:02:35 Re: PQnotifies() in 7.3 broken?
Previous Message Bruce Momjian 2002-12-11 03:50:37 Re: [INTERFACES] Patch for DBD::Pg pg_relcheck problem