diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-17 23:57:48 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-17 23:57:48 +0000 |
| commit | 9e0b4634732d089237c5eaecb91ad4b1e943bc0f (patch) | |
| tree | 0d859dec00da70831ab29720914d2f08b14d5183 /src/backend/catalog | |
| parent | fb0627d97238aab8e4cfe373df9f654c38de7229 (diff) | |
| download | postgresql-9e0b4634732d089237c5eaecb91ad4b1e943bc0f.tar.gz | |
setheapoverride() is history. Uses replaced with CommandCounterIncrement()
where necessary --- several of them didn't really need it, though.
tqual-checking macros simplified accordingly.
Diffstat (limited to 'src/backend/catalog')
| -rw-r--r-- | src/backend/catalog/aclchk.c | 6 | ||||
| -rw-r--r-- | src/backend/catalog/heap.c | 20 | ||||
| -rw-r--r-- | src/backend/catalog/index.c | 11 | ||||
| -rw-r--r-- | src/backend/catalog/pg_operator.c | 21 | ||||
| -rw-r--r-- | src/backend/catalog/pg_type.c | 6 |
5 files changed, 24 insertions, 40 deletions
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index 09aa138cf7..0e1a98d07c 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.35 2000/01/16 20:04:54 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.36 2000/01/17 23:57:43 tgl Exp $ * * NOTES * See acl.h. @@ -149,10 +149,8 @@ ChangeAcl(char *relname, replaces[Anum_pg_class_relacl - 1] = 'r'; values[Anum_pg_class_relacl - 1] = (Datum) new_acl; tuple = heap_modifytuple(tuple, relation, values, nulls, replaces); - /* XXX handle index on pg_class? */ - setheapoverride(true); + heap_update(relation, &tuple->t_self, tuple, NULL); - setheapoverride(false); /* keep the catalog indices up to date */ CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 0476f2c822..d61df6561b 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.116 2000/01/17 02:04:12 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.117 2000/01/17 23:57:43 tgl Exp $ * * * INTERFACE ROUTINES @@ -1065,7 +1065,7 @@ DeleteRelationTuple(Relation rel) pg_class_desc = heap_openr(RelationRelationName, RowExclusiveLock); tup = SearchSysCacheTupleCopy(RELOID, - ObjectIdGetDatum(rel->rd_att->attrs[0]->attrelid), + ObjectIdGetDatum(rel->rd_id), 0, 0, 0); if (!HeapTupleIsValid(tup)) { @@ -1509,31 +1509,25 @@ heap_drop_with_catalog(char *relname) DeleteAttributeTuples(rel); /* ---------------- - * delete comments + * delete comments, statistics, and constraints * ---------------- */ DeleteComments(RelationGetRelid(rel)); - /* ---------------- - * delete statistics - * ---------------- - */ RemoveStatistics(rel); + RemoveConstraints(rel); + /* ---------------- - * delete type tuple. here we want to see the effects - * of the deletions we just did, so we use setheapoverride(). + * delete type tuple * ---------------- */ - setheapoverride(true); DeleteTypeTuple(rel); - setheapoverride(false); /* ---------------- * delete relation tuple * ---------------- */ - /* must delete fake tuple in cache */ DeleteRelationTuple(rel); /* @@ -1541,8 +1535,6 @@ heap_drop_with_catalog(char *relname) */ ReleaseRelationBuffers(rel); - RemoveConstraints(rel); - /* ---------------- * unlink the relation's physical file and finish up. * ---------------- diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 7c7ffa3250..84009d6282 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.101 1999/12/20 10:40:40 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.102 2000/01/17 23:57:43 tgl Exp $ * * * INTERFACE ROUTINES @@ -904,19 +904,16 @@ InitIndexStrategy(int numatts, /* ---------------- * fill in the index strategy structure with information - * from the catalogs. Note: we use heap override mode - * in order to be allowed to see the correct information in the - * catalogs, even though our transaction has not yet committed. + * from the catalogs. First we must advance the command counter + * so that we will see the newly-entered index catalog tuples. * ---------------- */ - setheapoverride(true); + CommandCounterIncrement(); IndexSupportInitialize(strategy, support, attrelid, accessMethodObjectId, amstrategies, amsupport, numatts); - setheapoverride(false); - /* ---------------- * store the strategy information in the index reldesc * ---------------- diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c index a143c807c7..45c284cd9d 100644 --- a/src/backend/catalog/pg_operator.c +++ b/src/backend/catalog/pg_operator.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.47 2000/01/10 17:14:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.48 2000/01/17 23:57:43 tgl Exp $ * * NOTES * these routines moved here from commands/define.c and somewhat cleaned up. @@ -775,6 +775,9 @@ OperatorDef(char *operatorName, opKey[1].sk_argument = ObjectIdGetDatum(leftTypeId); opKey[2].sk_argument = ObjectIdGetDatum(rightTypeId); + /* Make sure we can see the shell even if it is new in current cmd */ + CommandCounterIncrement(); + pg_operator_scan = heap_beginscan(pg_operator_desc, 0, SnapshotSelf, /* no cache? */ @@ -790,9 +793,7 @@ OperatorDef(char *operatorName, nulls, replaces); - setheapoverride(true); heap_update(pg_operator_desc, &tup->t_self, tup, NULL); - setheapoverride(false); } else elog(ERROR, "OperatorDef: no operator %u", operatorObjectId); @@ -875,7 +876,13 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) pg_operator_desc = heap_openr(OperatorRelationName, RowExclusiveLock); - /* check and update the commutator, if necessary */ + /* + * check and update the commutator & negator, if necessary + * + * First make sure we can see them... + */ + CommandCounterIncrement(); + opKey[0].sk_argument = ObjectIdGetDatum(commId); pg_operator_scan = heap_beginscan(pg_operator_desc, @@ -920,9 +927,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) nulls, replaces); - setheapoverride(true); heap_update(pg_operator_desc, &tup->t_self, tup, NULL); - setheapoverride(false); if (RelationGetForm(pg_operator_desc)->relhasindex) { @@ -954,9 +959,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) nulls, replaces); - setheapoverride(true); heap_update(pg_operator_desc, &tup->t_self, tup, NULL); - setheapoverride(false); if (RelationGetForm(pg_operator_desc)->relhasindex) { @@ -994,9 +997,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) nulls, replaces); - setheapoverride(true); heap_update(pg_operator_desc, &tup->t_self, tup, NULL); - setheapoverride(false); if (RelationGetForm(pg_operator_desc)->relhasindex) { diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index 2b9e9d6ecc..3de8020595 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.46 2000/01/10 20:23:28 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.47 2000/01/17 23:57:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -481,9 +481,7 @@ TypeCreate(char *typeName, nulls, replaces); - setheapoverride(true); heap_update(pg_type_desc, &tup->t_self, tup, NULL); - setheapoverride(false); typeObjectId = tup->t_data->t_oid; } @@ -558,9 +556,7 @@ TypeRename(char *oldTypeName, char *newTypeName) namestrcpy(&(((Form_pg_type) GETSTRUCT(oldtup))->typname), newTypeName); - setheapoverride(true); heap_update(pg_type_desc, &oldtup->t_self, oldtup, NULL); - setheapoverride(false); /* update the system catalog indices */ CatalogOpenIndices(Num_pg_type_indices, Name_pg_type_indices, idescs); |
