dropdb lock

Started by Andrew Dunstanabout 20 years ago2 messages
#1Andrew Dunstan
andrew@dunslane.net

In dbcommands.c::dropdb() there are these lines:

/* Close pg_database, but keep exclusive lock till commit */
heap_close(pgdbrel, NoLock);

However, ISTM that if I return early from that function because the db
doesn't exist I should release the lock immediately. Or is there
something I have missed? Is that the only cleanup I would need for the
IF EXISTS case (looks like it to me)?

cheers

andrew

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: dropdb lock

Andrew Dunstan <andrew@dunslane.net> writes:

In dbcommands.c::dropdb() there are these lines:

/* Close pg_database, but keep exclusive lock till commit */
heap_close(pgdbrel, NoLock);

However, ISTM that if I return early from that function because the db
doesn't exist I should release the lock immediately. Or is there
something I have missed?

Should be OK to drop the lock if you didn't change anything. OTOH, it
probably doesn't matter much since we don't allow dropdb inside a
transaction block; commit is going to happen shortly anyhow.

regards, tom lane