diff options
author | Bruce Momjian <bruce@momjian.us> | 2003-02-19 04:02:54 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2003-02-19 04:02:54 +0000 |
commit | d0f3a7e9c453b10ad3c16a780858dd2621fc184a (patch) | |
tree | 65eb2dae2caf85698858259b36ba9c40ed1d848b /src/backend/parser | |
parent | 81f6db4803082f89b86a2d4701bf6237e6988db5 (diff) | |
download | postgresql-d0f3a7e9c453b10ad3c16a780858dd2621fc184a.tar.gz postgresql-d0f3a7e9c453b10ad3c16a780858dd2621fc184a.zip |
- Modifies LOCKTAG to include a 'classId'. Relation receive a classId of
RelOid_pg_class, and transaction locks XactLockTableId. RelId is renamed
to objId.
- LockObject() and UnlockObject() functions created, and their use
sprinkled throughout the code to do descent locking for domains and
types. They accept lock modes AccessShare and AccessExclusive, as we
only really need a 'read' and 'write' lock at the moment. Most locking
cases are held until the end of the transaction.
This fixes the cases Tom mentioned earlier in regards to locking with
Domains. If the patch is good, I'll work on cleaning up issues with
other database objects that have this problem (most of them).
Rod Taylor
Diffstat (limited to 'src/backend/parser')
-rw-r--r-- | src/backend/parser/parse_type.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c index 8f7c34cbd3d..56379a28119 100644 --- a/src/backend/parser/parse_type.c +++ b/src/backend/parser/parse_type.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.51 2003/02/09 06:56:28 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.52 2003/02/19 04:02:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,6 +23,7 @@ #include "parser/parser.h" #include "parser/parse_expr.h" #include "parser/parse_type.h" +#include "storage/lmgr.h" #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/syscache.h" @@ -127,6 +128,15 @@ LookupTypeName(const TypeName *typename) } } + /* + * Lock the type as having been read for remainder of the transaction + * + * XXX: There is a small time between the above and now when the type + * could dissapear. We *should* recheck to confirm the type still + * exists, but won't for speed. + */ + LockObject(restype, RelOid_pg_type, AccessShareLock); + return restype; } |