diff options
author | Bruce Momjian <bruce@momjian.us> | 2006-10-04 00:30:14 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2006-10-04 00:30:14 +0000 |
commit | f99a569a2ee3763b4ae174e81250c95ca0fdcbb6 (patch) | |
tree | 76e6371fe8b347c73d7020c0bc54b9fba519dc10 /src/backend/catalog | |
parent | 451e419e9852cdf9d7e7cefc09d5355abb3405e9 (diff) | |
download | postgresql-f99a569a2ee3763b4ae174e81250c95ca0fdcbb6.tar.gz |
pgindent run for 8.2.
Diffstat (limited to 'src/backend/catalog')
-rw-r--r-- | src/backend/catalog/aclchk.c | 109 | ||||
-rw-r--r-- | src/backend/catalog/catalog.c | 4 | ||||
-rw-r--r-- | src/backend/catalog/dependency.c | 21 | ||||
-rw-r--r-- | src/backend/catalog/heap.c | 36 | ||||
-rw-r--r-- | src/backend/catalog/index.c | 123 | ||||
-rw-r--r-- | src/backend/catalog/namespace.c | 12 | ||||
-rw-r--r-- | src/backend/catalog/pg_aggregate.c | 16 | ||||
-rw-r--r-- | src/backend/catalog/pg_depend.c | 4 | ||||
-rw-r--r-- | src/backend/catalog/pg_shdepend.c | 17 | ||||
-rw-r--r-- | src/backend/catalog/pg_type.c | 42 | ||||
-rw-r--r-- | src/backend/catalog/toasting.c | 4 |
11 files changed, 197 insertions, 191 deletions
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index e74c9b4410..27ca6e011a 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.131 2006/09/05 21:08:35 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.132 2006/10/04 00:29:50 momjian Exp $ * * NOTES * See acl.h. @@ -53,9 +53,9 @@ static List *objectNamesToOids(GrantObjectType objtype, List *objnames); static AclMode string_to_privilege(const char *privname); static const char *privilege_to_string(AclMode privilege); static AclMode restrict_and_check_grant(bool is_grant, AclMode avail_goptions, - bool all_privs, AclMode privileges, - Oid objectId, Oid grantorId, - AclObjectKind objkind, char *objname); + bool all_privs, AclMode privileges, + Oid objectId, Oid grantorId, + AclObjectKind objkind, char *objname); static AclMode pg_aclmask(AclObjectKind objkind, Oid table_oid, Oid roleid, AclMode mask, AclMaskHow how); @@ -156,8 +156,8 @@ restrict_and_check_grant(bool is_grant, AclMode avail_goptions, bool all_privs, AclMode privileges, Oid objectId, Oid grantorId, AclObjectKind objkind, char *objname) { - AclMode this_privileges; - AclMode whole_mask; + AclMode this_privileges; + AclMode whole_mask; switch (objkind) { @@ -189,9 +189,9 @@ restrict_and_check_grant(bool is_grant, AclMode avail_goptions, bool all_privs, } /* - * If we found no grant options, consider whether to issue a hard - * error. Per spec, having any privilege at all on the object will - * get you by here. + * If we found no grant options, consider whether to issue a hard error. + * Per spec, having any privilege at all on the object will get you by + * here. */ if (avail_goptions == ACL_NO_RIGHTS) { @@ -203,11 +203,10 @@ restrict_and_check_grant(bool is_grant, AclMode avail_goptions, bool all_privs, /* * Restrict the operation to what we can actually grant or revoke, and - * issue a warning if appropriate. (For REVOKE this isn't quite what - * the spec says to do: the spec seems to want a warning only if no - * privilege bits actually change in the ACL. In practice that - * behavior seems much too noisy, as well as inconsistent with the - * GRANT case.) + * issue a warning if appropriate. (For REVOKE this isn't quite what the + * spec says to do: the spec seems to want a warning only if no privilege + * bits actually change in the ACL. In practice that behavior seems much + * too noisy, as well as inconsistent with the GRANT case.) */ this_privileges = privileges & ACL_OPTION_TO_PRIVS(avail_goptions); if (is_grant) @@ -215,18 +214,18 @@ restrict_and_check_grant(bool is_grant, AclMode avail_goptions, bool all_privs, if (this_privileges == 0) ereport(WARNING, (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED), - errmsg("no privileges were granted for \"%s\"", objname))); + errmsg("no privileges were granted for \"%s\"", objname))); else if (!all_privs && this_privileges != privileges) ereport(WARNING, (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED), - errmsg("not all privileges were granted for \"%s\"", objname))); + errmsg("not all privileges were granted for \"%s\"", objname))); } else { if (this_privileges == 0) ereport(WARNING, (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), - errmsg("no privileges could be revoked for \"%s\"", objname))); + errmsg("no privileges could be revoked for \"%s\"", objname))); else if (!all_privs && this_privileges != privileges) ereport(WARNING, (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), @@ -285,11 +284,11 @@ ExecuteGrantStmt(GrantStmt *stmt) */ switch (stmt->objtype) { - /* - * Because this might be a sequence, we test both relation - * and sequence bits, and later do a more limited test - * when we know the object type. - */ + /* + * Because this might be a sequence, we test both relation and + * sequence bits, and later do a more limited test when we know + * the object type. + */ case ACL_OBJECT_RELATION: all_privileges = ACL_ALL_RIGHTS_RELATION | ACL_ALL_RIGHTS_SEQUENCE; errormsg = _("invalid privilege type %s for relation"); @@ -329,6 +328,7 @@ ExecuteGrantStmt(GrantStmt *stmt) if (stmt->privileges == NIL) { istmt.all_privs = true; + /* * will be turned into ACL_ALL_RIGHTS_* by the internal routines * depending on the object type @@ -595,28 +595,28 @@ ExecGrant_Relation(InternalGrant *istmt) } else this_privileges = istmt->privileges; - + /* - * The GRANT TABLE syntax can be used for sequences and - * non-sequences, so we have to look at the relkind to - * determine the supported permissions. The OR of - * table and sequence permissions were already checked. + * The GRANT TABLE syntax can be used for sequences and non-sequences, + * so we have to look at the relkind to determine the supported + * permissions. The OR of table and sequence permissions were already + * checked. */ if (istmt->objtype == ACL_OBJECT_RELATION) { if (pg_class_tuple->relkind == RELKIND_SEQUENCE) { /* - * For backward compatibility, throw just a warning - * for invalid sequence permissions when using the - * non-sequence GRANT syntax is used. + * For backward compatibility, throw just a warning for + * invalid sequence permissions when using the non-sequence + * GRANT syntax is used. */ if (this_privileges & ~((AclMode) ACL_ALL_RIGHTS_SEQUENCE)) { /* - * Mention the object name because the user needs to - * know which operations succeeded. This is required - * because WARNING allows the command to continue. + * Mention the object name because the user needs to know + * which operations succeeded. This is required because + * WARNING allows the command to continue. */ ereport(WARNING, (errcode(ERRCODE_INVALID_GRANT_OPERATION), @@ -628,15 +628,16 @@ ExecGrant_Relation(InternalGrant *istmt) else { if (this_privileges & ~((AclMode) ACL_ALL_RIGHTS_RELATION)) + /* - * USAGE is the only permission supported by sequences - * but not by non-sequences. Don't mention the object - * name because we didn't in the combined TABLE | - * SEQUENCE check. + * USAGE is the only permission supported by sequences but + * not by non-sequences. Don't mention the object name + * because we didn't in the combined TABLE | SEQUENCE + * check. */ ereport(ERROR, (errcode(ERRCODE_INVALID_GRANT_OPERATION), - errmsg("invalid privilege type USAGE for table"))); + errmsg("invalid privilege type USAGE for table"))); } } @@ -660,15 +661,15 @@ ExecGrant_Relation(InternalGrant *istmt) &grantorId, &avail_goptions); /* - * Restrict the privileges to what we can actually grant, and emit - * the standards-mandated warning and error messages. + * Restrict the privileges to what we can actually grant, and emit the + * standards-mandated warning and error messages. */ this_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, istmt->all_privs, this_privileges, relOid, grantorId, - pg_class_tuple->relkind == RELKIND_SEQUENCE - ? ACL_KIND_SEQUENCE : ACL_KIND_CLASS, + pg_class_tuple->relkind == RELKIND_SEQUENCE + ? ACL_KIND_SEQUENCE : ACL_KIND_CLASS, NameStr(pg_class_tuple->relname)); /* @@ -777,8 +778,8 @@ ExecGrant_Database(InternalGrant *istmt) &grantorId, &avail_goptions); /* - * Restrict the privileges to what we can actually grant, and emit - * the standards-mandated warning and error messages. + * Restrict the privileges to what we can actually grant, and emit the + * standards-mandated warning and error messages. */ this_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, @@ -893,8 +894,8 @@ ExecGrant_Function(InternalGrant *istmt) &grantorId, &avail_goptions); /* - * Restrict the privileges to what we can actually grant, and emit - * the standards-mandated warning and error messages. + * Restrict the privileges to what we can actually grant, and emit the + * standards-mandated warning and error messages. */ this_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, @@ -1019,8 +1020,8 @@ ExecGrant_Language(InternalGrant *istmt) &grantorId, &avail_goptions); /* - * Restrict the privileges to what we can actually grant, and emit - * the standards-mandated warning and error messages. + * Restrict the privileges to what we can actually grant, and emit the + * standards-mandated warning and error messages. */ this_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, @@ -1136,8 +1137,8 @@ ExecGrant_Namespace(InternalGrant *istmt) &grantorId, &avail_goptions); /* - * Restrict the privileges to what we can actually grant, and emit - * the standards-mandated warning and error messages. + * Restrict the privileges to what we can actually grant, and emit the + * standards-mandated warning and error messages. */ this_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, @@ -1259,8 +1260,8 @@ ExecGrant_Tablespace(InternalGrant *istmt) &grantorId, &avail_goptions); /* - * Restrict the privileges to what we can actually grant, and emit - * the standards-mandated warning and error messages. + * Restrict the privileges to what we can actually grant, and emit the + * standards-mandated warning and error messages. */ this_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, @@ -1565,7 +1566,7 @@ pg_class_aclmask(Oid table_oid, Oid roleid, * * As of 7.4 we have some updatable system views; those shouldn't be * protected in this way. Assume the view rules can take care of - * themselves. ACL_USAGE is if we ever have system sequences. + * themselves. ACL_USAGE is if we ever have system sequences. */ if ((mask & (ACL_INSERT | ACL_UPDATE | ACL_DELETE | ACL_USAGE)) && IsSystemClass(classForm) && @@ -1602,7 +1603,7 @@ pg_class_aclmask(Oid table_oid, Oid roleid, { /* No ACL, so build default ACL */ acl = acldefault(classForm->relkind == RELKIND_SEQUENCE ? - ACL_OBJECT_SEQUENCE : ACL_OBJECT_RELATION, + ACL_OBJECT_SEQUENCE : ACL_OBJECT_RELATION, ownerId); aclDatum = (Datum) 0; } diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c index 5d99acafc9..d302f023a9 100644 --- a/src/backend/catalog/catalog.c +++ b/src/backend/catalog/catalog.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.67 2006/07/31 20:09:00 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.68 2006/10/04 00:29:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -233,7 +233,7 @@ IsReservedName(const char *name) * * Hard-wiring this list is pretty grotty, but we really need it so that * we can compute the locktag for a relation (and then lock it) without - * having already read its pg_class entry. If we try to retrieve relisshared + * having already read its pg_class entry. If we try to retrieve relisshared * from pg_class with no pre-existing lock, there is a race condition against * anyone who is concurrently committing a change to the pg_class entry: * since we read system catalog entries under SnapshotNow, it's possible diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index 7007e83873..cab4f1006b 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.59 2006/08/20 21:56:16 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.60 2006/10/04 00:29:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -63,6 +63,7 @@ struct ObjectAddresses int numrefs; /* current number of references */ int maxrefs; /* current size of palloc'd array */ }; + /* typedef ObjectAddresses appears in dependency.h */ /* for find_expr_references_walker */ @@ -244,8 +245,8 @@ performMultipleDeletions(const ObjectAddresses *objects, { ObjectAddresses *implicit; ObjectAddresses *alreadyDeleted; - Relation depRel; - int i; + Relation depRel; + int i; implicit = new_object_addresses(); alreadyDeleted = new_object_addresses(); @@ -271,8 +272,8 @@ performMultipleDeletions(const ObjectAddresses *objects, continue; /* - * Add the objects dependent on this one to the global list of implicit - * objects. + * Add the objects dependent on this one to the global list of + * implicit objects. */ findAutoDeletableObjects(&obj, implicit, depRel, false); } @@ -707,8 +708,8 @@ recursiveDeletion(const ObjectAddress *object, */ /* - * Step 3: delete the object itself, and save it to the list of - * deleted objects if appropiate. + * Step 3: delete the object itself, and save it to the list of deleted + * objects if appropiate. */ doDeletion(object); if (alreadyDeleted != NULL) @@ -1284,7 +1285,7 @@ find_expr_references_walker(Node *node, } if (IsA(node, RelabelType)) { - RelabelType *relab = (RelabelType *) node; + RelabelType *relab = (RelabelType *) node; /* since there is no function dependency, need to depend on type */ add_object_address(OCLASS_TYPE, relab->resulttype, 0, @@ -1300,7 +1301,7 @@ find_expr_references_walker(Node *node, } if (IsA(node, RowExpr)) { - RowExpr *rowexpr = (RowExpr *) node; + RowExpr *rowexpr = (RowExpr *) node; add_object_address(OCLASS_TYPE, rowexpr->row_typeid, 0, context->addrs); @@ -1471,7 +1472,7 @@ object_address_comparator(const void *a, const void *b) ObjectAddresses * new_object_addresses(void) { - ObjectAddresses *addrs; + ObjectAddresses *addrs; addrs = palloc(sizeof(ObjectAddresses)); diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index e1f3e194b6..d30556d48c 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.312 2006/08/02 01:59:44 joe Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.313 2006/10/04 00:29:50 momjian Exp $ * * * INTERFACE ROUTINES @@ -607,8 +607,8 @@ InsertPgClassTuple(Relation pg_class_desc, tup = heap_formtuple(RelationGetDescr(pg_class_desc), values, nulls); /* - * The new tuple must have the oid already chosen for the rel. Sure - * would be embarrassing to do this sort of thing in polite company. + * The new tuple must have the oid already chosen for the rel. Sure would + * be embarrassing to do this sort of thing in polite company. */ HeapTupleSetOid(tup, new_rel_oid); @@ -666,8 +666,8 @@ AddNewRelationTuple(Relation pg_class_desc, else { /* - * Other relations will not have Xids in them, so set the initial value - * to InvalidTransactionId. + * Other relations will not have Xids in them, so set the initial + * value to InvalidTransactionId. */ new_rel_reltup->relminxid = InvalidTransactionId; new_rel_reltup->relvacuumxid = InvalidTransactionId; @@ -1975,7 +1975,7 @@ RemoveStatistics(Oid relid, AttrNumber attnum) * with the heap relation to zero tuples. * * The routine will truncate and then reconstruct the indexes on - * the specified relation. Caller must hold exclusive lock on rel. + * the specified relation. Caller must hold exclusive lock on rel. */ static void RelationTruncateIndexes(Relation heapRelation) @@ -2103,7 +2103,7 @@ heap_truncate_check_FKs(List *relations, bool tempTables) return; /* - * Otherwise, must scan pg_constraint. We make one pass with all the + * Otherwise, must scan pg_constraint. We make one pass with all the * relations considered; if this finds nothing, then all is well. */ dependents = heap_truncate_find_FKs(oids); @@ -2119,19 +2119,19 @@ heap_truncate_check_FKs(List *relations, bool tempTables) */ foreach(cell, oids) { - Oid relid = lfirst_oid(cell); - ListCell *cell2; + Oid relid = lfirst_oid(cell); + ListCell *cell2; dependents = heap_truncate_find_FKs(list_make1_oid(relid)); foreach(cell2, dependents) { - Oid relid2 = lfirst_oid(cell2); + Oid relid2 = lfirst_oid(cell2); if (!list_member_oid(oids, relid2)) { - char *relname = get_rel_name(relid); - char *relname2 = get_rel_name(relid2); + char *relname = get_rel_name(relid); + char *relname2 = get_rel_name(relid2); if (tempTables) ereport(ERROR, @@ -2145,9 +2145,9 @@ heap_truncate_check_FKs(List *relations, bool tempTables) errmsg("cannot truncate a table referenced in a foreign key constraint"), errdetail("Table \"%s\" references \"%s\".", relname2, relname), - errhint("Truncate table \"%s\" at the same time, " - "or use TRUNCATE ... CASCADE.", - relname2))); + errhint("Truncate table \"%s\" at the same time, " + "or use TRUNCATE ... CASCADE.", + relname2))); } } } @@ -2164,7 +2164,7 @@ heap_truncate_check_FKs(List *relations, bool tempTables) * behavior to change depending on chance locations of rows in pg_constraint.) * * Note: caller should already have appropriate lock on all rels mentioned - * in relationIds. Since adding or dropping an FK requires exclusive lock + * in relationIds. Since adding or dropping an FK requires exclusive lock * on both rels, this ensures that the answer will be stable. */ List * @@ -2176,8 +2176,8 @@ heap_truncate_find_FKs(List *relationIds) HeapTuple tuple; /* - * Must scan pg_constraint. Right now, it is a seqscan because - * there is no available index on confrelid. + * Must scan pg_constraint. Right now, it is a seqscan because there is + * no available index on confrelid. */ fkeyRel = heap_open(ConstraintRelationId, AccessShareLock); diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 60a30ce372..290cd27688 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.273 2006/08/25 04:06:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.274 2006/10/04 00:29:50 momjian Exp $ * * * INTERFACE ROUTINES @@ -58,7 +58,9 @@ typedef struct { Tuplesortstate *tuplesort; /* for sorting the index TIDs */ /* statistics (for debug purposes only): */ - double htups, itups, tups_inserted; + double htups, + itups, + tups_inserted; } v_i_state; /* non-export function prototypes */ @@ -449,7 +451,7 @@ UpdateIndexRelation(Oid indexoid, * allow_system_table_mods: allow table to be a system catalog * skip_build: true to skip the index_build() step for the moment; caller * must do it later (typically via reindex_index()) - * concurrent: if true, do not lock the table against writers. The index + * concurrent: if true, do not lock the table against writers. The index * will be marked "invalid" and the caller must take additional steps * to fix it up. * @@ -486,7 +488,7 @@ index_create(Oid heapRelationId, * (but not VACUUM). */ heapRelation = heap_open(heapRelationId, - (concurrent ? ShareUpdateExclusiveLock : ShareLock)); + (concurrent ? ShareUpdateExclusiveLock : ShareLock)); /* * The index will be in the same namespace as its parent table, and is @@ -509,8 +511,8 @@ index_create(Oid heapRelationId, errmsg("user-defined indexes on system catalog tables are not supported"))); /* - * concurrent index build on a system catalog is unsafe because we tend - * to release locks before committing in catalogs + * concurrent index build on a system catalog is unsafe because we tend to + * release locks before committing in catalogs */ if (concurrent && IsSystemRelation(heapRelation)) @@ -766,8 +768,8 @@ index_create(Oid heapRelationId, { /* * Caller is responsible for filling the index later on. However, - * we'd better make sure that the heap relation is correctly marked - * as having an index. + * we'd better make sure that the heap relation is correctly marked as + * having an index. */ index_update_stats(heapRelation, true, @@ -932,7 +934,7 @@ BuildIndexInfo(Relation index) /* other info */ ii->ii_Unique = indexStruct->indisunique; - ii->ii_Concurrent = false; /* assume normal case */ + ii->ii_Concurrent = false; /* assume normal case */ return ii; } @@ -1018,7 +1020,7 @@ FormIndexDatum(IndexInfo *indexInfo, * index_update_stats --- update pg_class entry after CREATE INDEX or REINDEX * * This routine updates the pg_class row of either an index or its parent - * relation after CREATE INDEX or REINDEX. Its rather bizarre API is designed + * relation after CREATE INDEX or REINDEX. Its rather bizarre API is designed * to ensure we can do all the necessary work in just one update. * * hasindex: set relhasindex to this value @@ -1031,7 +1033,7 @@ FormIndexDatum(IndexInfo *indexInfo, * * NOTE: an important side-effect of this operation is that an SI invalidation * message is sent out to all backends --- including me --- causing relcache - * entries to be flushed or updated with the new data. This must happen even + * entries to be flushed or updated with the new data. This must happen even * if we find that no change is needed in the pg_class row. When updating * a heap entry, this ensures that other backends find out about the new * index. When updating an index, it's important because some index AMs @@ -1041,7 +1043,7 @@ static void index_update_stats(Relation rel, bool hasindex, bool isprimary, Oid reltoastidxid, double reltuples) { - BlockNumber relpages = RelationGetNumberOfBlocks(rel); + BlockNumber relpages = RelationGetNumberOfBlocks(rel); Oid relid = RelationGetRelid(rel); Relation pg_class; HeapTuple tuple; @@ -1054,9 +1056,9 @@ index_update_stats(Relation rel, bool hasindex, bool isprimary, * * 1. In bootstrap mode, we have no choice --- UPDATE wouldn't work. * - * 2. We could be reindexing pg_class itself, in which case we can't - * move its pg_class row because CatalogUpdateIndexes might not know - * about all the indexes yet (see reindex_relation). + * 2. We could be reindexing pg_class itself, in which case we can't move + * its pg_class row because CatalogUpdateIndexes might not know about all + * the indexes yet (see reindex_relation). * * 3. Because we execute CREATE INDEX with just share lock on the parent * rel (to allow concurrent index creations), an ordinary update could @@ -1069,24 +1071,24 @@ index_update_stats(Relation rel, bool hasindex, bool isprimary, * 4. Even with just a single CREATE INDEX, there's a risk factor because * someone else might be trying to open the rel while we commit, and this * creates a race condition as to whether he will see both or neither of - * the pg_class row versions as valid. Again, a non-transactional update + * the pg_class row versions as valid. Again, a non-transactional update * avoids the risk. It is indeterminate which state of the row the other * process will see, but it doesn't matter (if he's only taking * AccessShareLock, then it's not critical that he see relhasindex true). * * It is safe to use a non-transactional update even though our - * transaction could still fail before committing. Setting relhasindex + * transaction could still fail before committing. Setting relhasindex * true is safe even if there are no indexes (VACUUM will eventually fix - * it), and of course the relpages and reltuples counts are correct (or - * at least more so than the old values) regardless. + * it), and of course the relpages and reltuples counts are correct (or at + * least more so than the old values) regardless. */ pg_class = heap_open(RelationRelationId, RowExclusiveLock); /* - * Make a copy of the tuple to update. Normally we use the syscache, - * but we can't rely on that during bootstrap or while reindexing - * pg_class itself. + * Make a copy of the tuple to update. Normally we use the syscache, but + * we can't rely on that during bootstrap or while reindexing pg_class + * itself. */ if (IsBootstrapProcessingMode() || ReindexIsProcessingHeap(RelationRelationId)) @@ -1245,7 +1247,7 @@ setNewRelfilenode(Relation relation) * index_build - invoke access-method-specific index build procedure * * On entry, the index's catalog entries are valid, and its physical disk - * file has been created but is empty. We call the AM-specific build + * file has been created but is empty. We call the AM-specific build * procedure to fill in the index contents. We then update the pg_class * entries of the index and heap relation as needed, using statistics * returned by ambuild as well as data passed by the caller. @@ -1365,22 +1367,21 @@ IndexBuildHeapScan(Relation heapRelation, estate); /* - * Prepare for scan of the base relation. In a normal index build, - * we use SnapshotAny because we must retrieve all tuples and do our own - * time qual checks (because we have to index RECENTLY_DEAD tuples). - * In a concurrent build, we take a regular MVCC snapshot and index - * whatever's live according to that. During bootstrap we just use - * SnapshotNow. + * Prepare for scan of the base relation. In a normal index build, we use + * SnapshotAny because we must retrieve all tuples and do our own time + * qual checks (because we have to index RECENTLY_DEAD tuples). In a + * concurrent build, we take a regular MVCC snapshot and index whatever's + * live according to that. During bootstrap we just use SnapshotNow. */ if (IsBootstrapProcessingMode()) { snapshot = SnapshotNow; - OldestXmin = InvalidTransactionId; /* not used */ + OldestXmin = InvalidTransactionId; /* not used */ } else if (indexInfo->ii_Concurrent) { snapshot = CopySnapshot(GetTransactionSnapshot()); - OldestXmin = InvalidTransactionId; /* not used */ + OldestXmin = InvalidTransactionId; /* not used */ } else { @@ -1391,8 +1392,8 @@ IndexBuildHeapScan(Relation heapRelation, scan = heap_beginscan(heapRelation, /* relation */ snapshot, /* seeself */ - 0, /* number of keys */ - NULL); /* scan key */ + 0, /* number of keys */ + NULL); /* scan key */ reltuples = 0; @@ -1435,9 +1436,9 @@ IndexBuildHeapScan(Relation heapRelation, /* * If tuple is recently deleted then we must index it * anyway to preserve MVCC semantics. (Pre-existing - * transactions could try to use the index after we - * finish building it, and may need to see such tuples.) - * Exclude it from unique-checking, however. + * transactions could try to use the index after we finish + * building it, and may need to see such tuples.) Exclude + * it from unique-checking, however. */ indexIt = true; tupleIsAlive = false; @@ -1573,7 +1574,7 @@ IndexBuildHeapScan(Relation heapRelation, * which is passed to validate_index(). Any tuples that are valid according * to this snap, but are not in the index, must be added to the index. * (Any tuples committed live after the snap will be inserted into the - * index by their originating transaction. Any tuples committed dead before + * index by their originating transaction. Any tuples committed dead before * the snap need not be indexed, because we will wait out all transactions * that might care about them before we mark the index valid.) * @@ -1582,7 +1583,7 @@ IndexBuildHeapScan(Relation heapRelation, * ever say "delete it". (This should be faster than a plain indexscan; * also, not all index AMs support full-index indexscan.) Then we sort the * TIDs, and finally scan the table doing a "merge join" against the TID list - * to see which tuples are missing from the index. Thus we will ensure that + * to see which tuples are missing from the index. Thus we will ensure that * all tuples valid according to the reference snapshot are in the index. * * Building a unique index this way is tricky: we might try to insert a @@ -1598,7 +1599,7 @@ IndexBuildHeapScan(Relation heapRelation, * were alive at the time of the reference snapshot are gone; this is * necessary to be sure there are none left with a serializable snapshot * older than the reference (and hence possibly able to see tuples we did - * not index). Then we mark the index valid and commit. + * not index). Then we mark the index valid and commit. * * Doing two full table scans is a brute-force strategy. We could try to be * cleverer, eg storing new tuples in a special area of the table (perhaps @@ -1608,10 +1609,11 @@ IndexBuildHeapScan(Relation heapRelation, void validate_index(Oid heapId, Oid indexId, Snapshot snapshot) { - Relation heapRelation, indexRelation; - IndexInfo *indexInfo; + Relation heapRelation, + indexRelation; + IndexInfo *indexInfo; IndexVacuumInfo ivinfo; - v_i_state state; + v_i_state state; /* Open and lock the parent heap relation */ heapRelation = heap_open(heapId, ShareUpdateExclusiveLock); @@ -1619,9 +1621,9 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot) indexRelation = index_open(indexId, RowExclusiveLock); /* - * Fetch info needed for index_insert. (You might think this should - * be passed in from DefineIndex, but its copy is long gone due to - * having been built in a previous transaction.) + * Fetch info needed for index_insert. (You might think this should be + * passed in from DefineIndex, but its copy is long gone due to having + * been built in a previous transaction.) */ indexInfo = BuildIndexInfo(indexRelation); @@ -1675,7 +1677,7 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot) static bool validate_index_callback(ItemPointer itemptr, void *opaque) { - v_i_state *state = (v_i_state *) opaque; + v_i_state *state = (v_i_state *) opaque; tuplesort_putdatum(state->tuplesort, PointerGetDatum(itemptr), false); state->itups += 1; @@ -1703,9 +1705,10 @@ validate_index_heapscan(Relation heapRelation, TupleTableSlot *slot; EState *estate; ExprContext *econtext; + /* state variables for the merge */ ItemPointer indexcursor = NULL; - bool tuplesort_empty = false; + bool tuplesort_empty = false; /* * sanity checks @@ -1734,8 +1737,8 @@ validate_index_heapscan(Relation heapRelation, */ scan = heap_beginscan(heapRelation, /* relation */ snapshot, /* seeself */ - 0, /* number of keys */ - NULL); /* scan key */ + 0, /* number of keys */ + NULL); /* scan key */ /* * Scan all tuples matching the snapshot. @@ -1749,15 +1752,15 @@ validate_index_heapscan(Relation heapRelation, state->htups += 1; /* - * "merge" by skipping through the index tuples until we find or - * pass the current heap tuple. + * "merge" by skipping through the index tuples until we find or pass + * the current heap tuple. */ while (!tuplesort_empty && (!indexcursor || ItemPointerCompare(indexcursor, heapcursor) < 0)) { - Datum ts_val; - bool ts_isnull; + Datum ts_val; + bool ts_isnull; if (indexcursor) pfree(indexcursor); @@ -1774,7 +1777,7 @@ validate_index_heapscan(Relation heapRelation, * We've overshot which means this heap tuple is missing from the * index, so insert it. */ - bool check_unique; + bool check_unique; MemoryContextReset(econtext->ecxt_per_tuple_memory); @@ -1793,7 +1796,7 @@ validate_index_heapscan(Relation heapRelation, /* * For the current heap tuple, extract all the attributes we use - * in this index, and note which are null. This also performs + * in this index, and note which are null. This also performs * evaluation of any expressions needed. */ FormIndexDatum(indexInfo, @@ -1803,11 +1806,11 @@ validate_index_heapscan(Relation heapRelation, isnull); /* - * If the tuple is already committed dead, we still have to - * put it in the index (because some xacts might be able to - * see it), but we might as well suppress uniqueness checking. - * This is just an optimization because the index AM is not - * supposed to raise a uniqueness failure anyway. + * If the tuple is already committed dead, we still have to put it + * in the index (because some xacts might be able to see it), but + * we might as well suppress uniqueness checking. This is just an + * optimization because the index AM is not supposed to raise a + * uniqueness failure anyway. */ if (indexInfo->ii_Unique) { diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index abd3547e5e..1d6162ca12 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -13,7 +13,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.87 2006/09/14 22:05:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.88 2006/10/04 00:29:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -718,7 +718,7 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright) ObjectIdGetDatum(namespaceId)); if (HeapTupleIsValid(opertup)) { - Oid result = HeapTupleGetOid(opertup); + Oid result = HeapTupleGetOid(opertup); ReleaseSysCache(opertup); return result; @@ -741,9 +741,9 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright) } /* - * We have to find the list member that is first in the search path, - * if there's more than one. This doubly-nested loop looks ugly, - * but in practice there should usually be few catlist members. + * We have to find the list member that is first in the search path, if + * there's more than one. This doubly-nested loop looks ugly, but in + * practice there should usually be few catlist members. */ recomputeNamespacePath(); @@ -759,7 +759,7 @@ OpernameGetOprid(List *names, Oid oprleft, Oid oprright) if (operform->oprnamespace == namespaceId) { - Oid result = HeapTupleGetOid(opertup); + Oid result = HeapTupleGetOid(opertup); ReleaseSysCacheList(catlist); return result; diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c index 747543e077..6420defe4f 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.82 2006/07/27 19:52:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.83 2006/10/04 00:29:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -89,15 +89,15 @@ AggregateCreate(const char *aggName, } /* - * If transtype is polymorphic, must have polymorphic argument also; - * else we will have no way to deduce the actual transtype. + * If transtype is polymorphic, must have polymorphic argument also; else + * we will have no way to deduce the actual transtype. */ if (!hasPolyArg && (aggTransType == ANYARRAYOID || aggTransType == ANYELEMENTOID)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("cannot determine transition data type"), - errdetail("An aggregate using \"anyarray\" or \"anyelement\" as transition type must have at least one argument of either type."))); + errdetail("An aggregate using \"anyarray\" or \"anyelement\" as transition type must have at least one argument of either type."))); /* find the transfn */ nargs_transfn = numArgs + 1; @@ -133,8 +133,8 @@ AggregateCreate(const char *aggName, /* * If the transfn is strict and the initval is NULL, make sure first input - * type and transtype are the same (or at least binary-compatible), so that - * it's OK to use the first input value as the initial transValue. + * type and transtype are the same (or at least binary-compatible), so + * that it's OK to use the first input value as the initial transValue. */ if (proc->proisstrict && agginitval == NULL) { @@ -211,7 +211,7 @@ AggregateCreate(const char *aggName, PROVOLATILE_IMMUTABLE, /* volatility (not * needed for agg) */ buildoidvector(aggArgTypes, - numArgs), /* paramTypes */ + numArgs), /* paramTypes */ PointerGetDatum(NULL), /* allParamTypes */ PointerGetDatum(NULL), /* parameterModes */ PointerGetDatum(NULL)); /* parameterNames */ @@ -355,7 +355,7 @@ lookup_agg_function(List *fnName, ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("function %s requires run-time type coercion", - func_signature_string(fnName, nargs, true_oid_array)))); + func_signature_string(fnName, nargs, true_oid_array)))); } /* Check aggregate creator has permission to call the function */ diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c index 99cdf5e7e6..b0c5986251 100644 --- a/src/backend/catalog/pg_depend.c +++ b/src/backend/catalog/pg_depend.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.22 2006/08/21 00:57:24 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.23 2006/10/04 00:29:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -264,7 +264,7 @@ changeDependencyFor(Oid classId, Oid objectId, * Detect whether a sequence is marked as "owned" by a column * * An ownership marker is an AUTO dependency from the sequence to the - * column. If we find one, store the identity of the owning column + * column. If we find one, store the identity of the owning column * into *tableId and *colId and return TRUE; else return FALSE. * * Note: if there's more than one such pg_depend entry then you get diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c index 85e3d968d4..5195cb06be 100644 --- a/src/backend/catalog/pg_shdepend.c +++ b/src/backend/catalog/pg_shdepend.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.14 2006/08/21 00:57:24 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.15 2006/10/04 00:29:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1101,9 +1101,9 @@ shdepDropOwned(List *roleids, DropBehavior behavior) while ((tuple = systable_getnext(scan)) != NULL) { - ObjectAddress obj; - GrantObjectType objtype; - InternalGrant istmt; + ObjectAddress obj; + GrantObjectType objtype; + InternalGrant istmt; Form_pg_shdepend sdepForm = (Form_pg_shdepend) GETSTRUCT(tuple); /* We only operate on objects in the current database */ @@ -1112,7 +1112,7 @@ shdepDropOwned(List *roleids, DropBehavior behavior) switch (sdepForm->deptype) { - /* Shouldn't happen */ + /* Shouldn't happen */ case SHARED_DEPENDENCY_PIN: case SHARED_DEPENDENCY_INVALID: elog(ERROR, "unexpected dependency type"); @@ -1267,10 +1267,11 @@ shdepReassignOwned(List *roleids, Oid newrole) break; case RelationRelationId: + /* - * Pass recursing = true so that we don't fail on - * indexes, owned sequences, etc when we happen - * to visit them before their parent table. + * Pass recursing = true so that we don't fail on indexes, + * owned sequences, etc when we happen to visit them + * before their parent table. */ ATExecChangeOwner(sdepForm->objid, newrole, true); break; diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index 1b9eea29dc..32de0b90dc 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.107 2006/07/14 14:52:18 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.108 2006/10/04 00:29:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -73,34 +73,34 @@ TypeShellMake(const char *typeName, Oid typeNamespace) /* * initialize *values with the type name and dummy values * - * The representational details are the same as int4 ... it doesn't - * really matter what they are so long as they are consistent. Also - * note that we give it typtype = 'p' (pseudotype) as extra insurance - * that it won't be mistaken for a usable type. + * The representational details are the same as int4 ... it doesn't really + * matter what they are so long as they are consistent. Also note that we + * give it typtype = 'p' (pseudotype) as extra insurance that it won't be + * mistaken for a usable type. */ i = 0; namestrcpy(&name, typeName); values[i++] = NameGetDatum(&name); /* typname */ values[i++] = ObjectIdGetDatum(typeNamespace); /* typnamespace */ values[i++] = ObjectIdGetDatum(GetUserId()); /* typowner */ - values[i++] = Int16GetDatum(sizeof(int4)); /* typlen */ - values[i++] = BoolGetDatum(true); /* typbyval */ - values[i++] = CharGetDatum('p'); /* typtype */ - values[i++] = BoolGetDatum(false); /* typisdefined */ + values[i++] = Int16GetDatum(sizeof(int4)); /* typlen */ + values[i++] = BoolGetDatum(true); /* typbyval */ + values[i++] = CharGetDatum('p'); /* typtype */ + values[i++] = BoolGetDatum(false); /* typisdefined */ values[i++] = CharGetDatum(DEFAULT_TYPDELIM); /* typdelim */ - values[i++] = ObjectIdGetDatum(InvalidOid); /* typrelid */ - values[i++] = ObjectIdGetDatum(InvalidOid); /* typelem */ - values[i++] = ObjectIdGetDatum(F_SHELL_IN); /* typinput */ + values[i++] = ObjectIdGetDatum(InvalidOid); /* typrelid */ + values[i++] = ObjectIdGetDatum(InvalidOid); /* typelem */ + values[i++] = ObjectIdGetDatum(F_SHELL_IN); /* typinput */ values[i++] = ObjectIdGetDatum(F_SHELL_OUT); /* typoutput */ - values[i++] = ObjectIdGetDatum(InvalidOid); /* typreceive */ - values[i++] = ObjectIdGetDatum(InvalidOid); /* typsend */ - values[i++] = ObjectIdGetDatum(InvalidOid); /* typanalyze */ - values[i++] = CharGetDatum('i'); /* typalign */ - values[i++] = CharGetDatum('p'); /* typstorage */ - values[i++] = BoolGetDatum(false); /* typnotnull */ - values[i++] = ObjectIdGetDatum(InvalidOid); /* typbasetype */ - values[i++] = Int32GetDatum(-1); /* typtypmod */ - values[i++] = Int32GetDatum(0); /* typndims */ + values[i++] = ObjectIdGetDatum(InvalidOid); /* typreceive */ + values[i++] = ObjectIdGetDatum(InvalidOid); /* typsend */ + values[i++] = ObjectIdGetDatum(InvalidOid); /* typanalyze */ + values[i++] = CharGetDatum('i'); /* typalign */ + values[i++] = CharGetDatum('p'); /* typstorage */ + values[i++] = BoolGetDatum(false); /* typnotnull */ + values[i++] = ObjectIdGetDatum(InvalidOid); /* typbasetype */ + values[i++] = Int32GetDatum(-1); /* typtypmod */ + values[i++] = Int32GetDatum(0); /* typndims */ nulls[i++] = 'n'; /* typdefaultbin */ nulls[i++] = 'n'; /* typdefault */ diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c index aa3e7b8fef..c4416d5e01 100644 --- a/src/backend/catalog/toasting.c +++ b/src/backend/catalog/toasting.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.2 2006/08/25 04:06:47 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.3 2006/10/04 00:29:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -70,7 +70,7 @@ AlterTableCreateToastTable(Oid relOid) void BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid) { - Relation rel; + Relation rel; rel = heap_openrv(makeRangeVar(NULL, relName), AccessExclusiveLock); |