From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Locking for Rename To new_name works differently for different objects |
Date: | 2014-10-15 11:00:10 |
Message-ID: | CAA4eK1+S22=PqJ0FxK-XdiA7UTPERsrfdompPDGkM4tKD=-FtA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I have observed that for renaming some of the objects
AccessExclusiveLock is taken on object whereas for
other kind of objects no lock is taken on object before
renaming the object.
The object's that are renamed via AlterObjectRename_internal()
takes the lock (during get_object_address() call) whereas for
other objects, there is no lock. I think there is exception to it
i.e for Rename table, it also takes lock. Refer below function:
ExecRenameStmt()
{
..
..
case OBJECT_AGGREGATE:
case OBJECT_COLLATION:
case OBJECT_CONVERSION:
case OBJECT_EVENT_TRIGGER:
case OBJECT_FDW:
...
address = get_object_address(stmt->renameType,
stmt->object, stmt->objarg,
&relation,
AccessExclusiveLock, false);
Assert(relation == NULL);
catalog = heap_open(address.classId, RowExclusiveLock);
AlterObjectRename_internal(catalog,
address.objectId,
stmt->newname);
..
}
Is there a reason for different locking strategy?
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2014-10-15 11:38:48 | Re: jsonb generator functions |
Previous Message | David Rowley | 2014-10-15 10:03:01 | Re: Patch to support SEMI and ANTI join removal |