Re: Locking for Rename To new_name works differently for different objects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Locking for Rename To new_name works differently for different objects
Date: 2014-10-15 14:04:52
Message-ID: 4539.1413381892@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> 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 usual theory for DDL updates of all types (not just rename)
is that an explicit lock is only needed for objects whose catalog
representation comprises more than one row. Otherwise, the implicit
locking involved in updating that row is sufficient to serialize
different updates.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2014-10-15 14:12:40 Re: group locking: incomplete patch, just for discussion
Previous Message Kouhei Kaigai 2014-10-15 13:58:02 Re: How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale