mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Fix LOCK TABLE to eliminate the race condition that could make it give weird
errors when tables are concurrently dropped. To do this we must take lock on each relation before we check its privileges. The old code was trying to do that the other way around, which is a bit pointless when there are lots of other commands that lock relations before checking privileges. I did keep it checking each relation's privilege before locking the next relation, which is a detail that ALTER TABLE isn't too picky about.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.141 2009/01/01 17:23:56 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.142 2009/05/12 16:43:32 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -49,7 +49,6 @@ typedef enum
|
||||
/* in heap/heapam.c */
|
||||
extern Relation relation_open(Oid relationId, LOCKMODE lockmode);
|
||||
extern Relation try_relation_open(Oid relationId, LOCKMODE lockmode);
|
||||
extern Relation relation_open_nowait(Oid relationId, LOCKMODE lockmode);
|
||||
extern Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode);
|
||||
extern Relation try_relation_openrv(const RangeVar *relation, LOCKMODE lockmode);
|
||||
extern void relation_close(Relation relation, LOCKMODE lockmode);
|
||||
|
||||
Reference in New Issue
Block a user