Re: [HACKERS] DROP TABLE inside transaction block - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] DROP TABLE inside transaction block
Date
Msg-id 26413.936673255@sss.pgh.pa.us
Whole thread Raw
In response to RE: [HACKERS] DROP TABLE inside transaction block  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
List pgsql-hackers
"Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
>> That's a good point --- we acquire exclusive lock anyway on a table
>> about to be deleted, so just holding that lock till end of transaction
>> should prevent other backends from trying to touch the table.

> That reminds me.
> DROP TABLE doesn't hold exlusive lock till end of transaction.
> UnlockRelation() seems too early.

I wondered about that too --- but I didn't change it because I wasn't
sure it was wrong.  Vadim, what do you think?

> Seems ALTER TABLE doesn't acquire any lock for the target
> relation. It's OK ?

None?  Yipes.  Seems to me it should *definitely* be grabbing
AccessExclusiveLock.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] DROP TABLE inside transaction block
Next
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] DROP TABLE inside transaction block