diff options
| author | Bruce Momjian | 2005-10-15 02:49:52 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2005-10-15 02:49:52 +0000 |
| commit | 1dc34982511d91ef8a2b71bdcb870f067c1b3da9 (patch) | |
| tree | 1046adab1d4b964e0c38afeec0ee6546f61d9a8a /src/backend/rewrite | |
| parent | 790c01d28099587bbe2c623d4389b62ee49b1dee (diff) | |
Standard pgindent run for 8.1.
Diffstat (limited to 'src/backend/rewrite')
| -rw-r--r-- | src/backend/rewrite/rewriteDefine.c | 124 | ||||
| -rw-r--r-- | src/backend/rewrite/rewriteHandler.c | 321 | ||||
| -rw-r--r-- | src/backend/rewrite/rewriteManip.c | 104 | ||||
| -rw-r--r-- | src/backend/rewrite/rewriteRemove.c | 10 | ||||
| -rw-r--r-- | src/backend/rewrite/rewriteSupport.c | 5 |
5 files changed, 273 insertions, 291 deletions
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c index c28ea627e50..76b25766465 100644 --- a/src/backend/rewrite/rewriteDefine.c +++ b/src/backend/rewrite/rewriteDefine.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.105 2005/06/28 05:08:59 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.106 2005/10/15 02:49:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -101,8 +101,8 @@ InsertRule(char *rulname, if (!replace) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("rule \"%s\" for relation \"%s\" already exists", - rulname, get_rel_name(eventrel_oid)))); + errmsg("rule \"%s\" for relation \"%s\" already exists", + rulname, get_rel_name(eventrel_oid)))); /* * When replacing, we don't need to replace every attribute @@ -143,8 +143,8 @@ InsertRule(char *rulname, /* * Install dependency on rule's relation to ensure it will go away on * relation deletion. If the rule is ON SELECT, make the dependency - * implicit --- this prevents deleting a view's SELECT rule. Other - * kinds of rules can be AUTO. + * implicit --- this prevents deleting a view's SELECT rule. Other kinds + * of rules can be AUTO. */ myself.classId = RewriteRelationId; myself.objectId = rewriteObjectId; @@ -155,7 +155,7 @@ InsertRule(char *rulname, referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, - (evtype == CMD_SELECT) ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO); + (evtype == CMD_SELECT) ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO); /* * Also install dependencies on objects referenced in action and qual. @@ -199,11 +199,10 @@ DefineQueryRewrite(RuleStmt *stmt) /* * If we are installing an ON SELECT rule, we had better grab - * AccessExclusiveLock to ensure no SELECTs are currently running on - * the event relation. For other types of rules, it might be - * sufficient to grab ShareLock to lock out insert/update/delete - * actions. But for now, let's just grab AccessExclusiveLock all the - * time. + * AccessExclusiveLock to ensure no SELECTs are currently running on the + * event relation. For other types of rules, it might be sufficient to + * grab ShareLock to lock out insert/update/delete actions. But for now, + * let's just grab AccessExclusiveLock all the time. */ event_relation = heap_openrv(event_obj, AccessExclusiveLock); ev_relid = RelationGetRelid(event_relation); @@ -253,7 +252,7 @@ DefineQueryRewrite(RuleStmt *stmt) if (list_length(action) == 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("INSTEAD NOTHING rules on SELECT are not implemented"), + errmsg("INSTEAD NOTHING rules on SELECT are not implemented"), errhint("Use views instead."))); /* @@ -271,7 +270,7 @@ DefineQueryRewrite(RuleStmt *stmt) if (!is_instead || query->commandType != CMD_SELECT) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("rules on SELECT must have action INSTEAD SELECT"))); + errmsg("rules on SELECT must have action INSTEAD SELECT"))); /* * ... there can be no rule qual, ... @@ -299,18 +298,17 @@ DefineQueryRewrite(RuleStmt *stmt) if (i > event_relation->rd_att->natts) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("SELECT rule's target list has too many entries"))); + errmsg("SELECT rule's target list has too many entries"))); attr = event_relation->rd_att->attrs[i - 1]; attname = NameStr(attr->attname); /* - * Disallow dropped columns in the relation. This won't - * happen in the cases we actually care about (namely creating - * a view via CREATE TABLE then CREATE RULE). Trying to cope - * with it is much more trouble than it's worth, because we'd - * have to modify the rule to insert dummy NULLs at the right - * positions. + * Disallow dropped columns in the relation. This won't happen in + * the cases we actually care about (namely creating a view via + * CREATE TABLE then CREATE RULE). Trying to cope with it is much + * more trouble than it's worth, because we'd have to modify the + * rule to insert dummy NULLs at the right positions. */ if (attr->attisdropped) ereport(ERROR, @@ -328,11 +326,10 @@ DefineQueryRewrite(RuleStmt *stmt) errmsg("SELECT rule's target entry %d has different type from column \"%s\"", i, attname))); /* - * Allow typmods to be different only if one of them is -1, - * ie, "unspecified". This is necessary for cases like - * "numeric", where the table will have a filled-in default - * length but the select rule's expression will probably have - * typmod = -1. + * Allow typmods to be different only if one of them is -1, ie, + * "unspecified". This is necessary for cases like "numeric", + * where the table will have a filled-in default length but the + * select rule's expression will probably have typmod = -1. */ tletypmod = exprTypmod((Node *) tle->expr); if (attr->atttypmod != tletypmod && @@ -345,7 +342,7 @@ DefineQueryRewrite(RuleStmt *stmt) if (i != event_relation->rd_att->natts) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("SELECT rule's target list has too few entries"))); + errmsg("SELECT rule's target list has too few entries"))); /* * ... there must not be another ON SELECT rule already ... @@ -359,9 +356,9 @@ DefineQueryRewrite(RuleStmt *stmt) rule = event_relation->rd_rules->rules[i]; if (rule->event == CMD_SELECT) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("\"%s\" is already a view", - RelationGetRelationName(event_relation)))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("\"%s\" is already a view", + RelationGetRelationName(event_relation)))); } } @@ -371,30 +368,30 @@ DefineQueryRewrite(RuleStmt *stmt) if (strcmp(stmt->rulename, ViewSelectRuleName) != 0) { /* - * In versions before 7.3, the expected name was _RETviewname. - * For backwards compatibility with old pg_dump output, accept - * that and silently change it to _RETURN. Since this is just - * a quick backwards-compatibility hack, limit the number of - * characters checked to a few less than NAMEDATALEN; this - * saves having to worry about where a multibyte character - * might have gotten truncated. + * In versions before 7.3, the expected name was _RETviewname. For + * backwards compatibility with old pg_dump output, accept that + * and silently change it to _RETURN. Since this is just a quick + * backwards-compatibility hack, limit the number of characters + * checked to a few less than NAMEDATALEN; this saves having to + * worry about where a multibyte character might have gotten + * truncated. */ if (strncmp(stmt->rulename, "_RET", 4) != 0 || strncmp(stmt->rulename + 4, event_obj->relname, NAMEDATALEN - 4 - 4) != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("view rule for \"%s\" must be named \"%s\"", - event_obj->relname, ViewSelectRuleName))); + errmsg("view rule for \"%s\" must be named \"%s\"", + event_obj->relname, ViewSelectRuleName))); stmt->rulename = pstrdup(ViewSelectRuleName); } /* * Are we converting a relation to a view? * - * If so, check that the relation is empty because the storage for - * the relation is going to be deleted. Also insist that the rel - * not have any triggers, indexes, or child tables. + * If so, check that the relation is empty because the storage for the + * relation is going to be deleted. Also insist that the rel not have + * any triggers, indexes, or child tables. */ if (event_relation->rd_rel->relkind != RELKIND_VIEW) { @@ -403,29 +400,29 @@ DefineQueryRewrite(RuleStmt *stmt) scanDesc = heap_beginscan(event_relation, SnapshotNow, 0, NULL); if (heap_getnext(scanDesc, ForwardScanDirection) != NULL) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("could not convert table \"%s\" to a view because it is not empty", - event_obj->relname))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("could not convert table \"%s\" to a view because it is not empty", + event_obj->relname))); heap_endscan(scanDesc); if (event_relation->rd_rel->reltriggers != 0) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("could not convert table \"%s\" to a view because it has triggers", - event_obj->relname), - errhint("In particular, the table may not be involved in any foreign key relationships."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("could not convert table \"%s\" to a view because it has triggers", + event_obj->relname), + errhint("In particular, the table may not be involved in any foreign key relationships."))); if (event_relation->rd_rel->relhasindex) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("could not convert table \"%s\" to a view because it has indexes", - event_obj->relname))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("could not convert table \"%s\" to a view because it has indexes", + event_obj->relname))); if (event_relation->rd_rel->relhassubclass) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("could not convert table \"%s\" to a view because it has child tables", - event_obj->relname))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("could not convert table \"%s\" to a view because it has child tables", + event_obj->relname))); RelisBecomingView = true; } @@ -438,11 +435,10 @@ DefineQueryRewrite(RuleStmt *stmt) event_attype = InvalidOid; /* - * We want the rule's table references to be checked as though by the - * rule owner, not the user referencing the rule. Therefore, scan - * through the rule's rtables and set the checkAsUser field on all - * rtable entries. We have to look at event_qual as well, in case it - * contains sublinks. + * We want the rule's table references to be checked as though by the rule + * owner, not the user referencing the rule. Therefore, scan through the + * rule's rtables and set the checkAsUser field on all rtable entries. We + * have to look at event_qual as well, in case it contains sublinks. */ foreach(l, action) { @@ -468,17 +464,15 @@ DefineQueryRewrite(RuleStmt *stmt) * appropriate, also modify the 'relkind' field to show that the * relation is now a view. * - * Important side effect: an SI notice is broadcast to force all - * backends (including me!) to update relcache entries with the - * new rule. + * Important side effect: an SI notice is broadcast to force all backends + * (including me!) to update relcache entries with the new rule. */ SetRelationRuleStatus(ev_relid, true, RelisBecomingView); } /* - * IF the relation is becoming a view, delete the storage files - * associated with it. NB: we had better have AccessExclusiveLock to - * do this ... + * IF the relation is becoming a view, delete the storage files associated + * with it. NB: we had better have AccessExclusiveLock to do this ... * * XXX what about getting rid of its TOAST table? For now, we don't. */ diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c index 1c58ccd7ca3..3513cf67c4b 100644 --- a/src/backend/rewrite/rewriteHandler.c +++ b/src/backend/rewrite/rewriteHandler.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.157 2005/08/01 20:31:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.158 2005/10/15 02:49:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ static TargetEntry *process_matched_tle(TargetEntry *src_tle, const char *attrName); static Node *get_assignment_input(Node *node); static void markQueryForLocking(Query *qry, bool forUpdate, bool noWait, - bool skipOldNew); + bool skipOldNew); static List *matchLocks(CmdType event, RuleLock *rulelocks, int varno, Query *parsetree); static Query *fireRIRrules(Query *parsetree, List *activeRIRs); @@ -115,17 +115,17 @@ AcquireRewriteLocks(Query *parsetree) switch (rte->rtekind) { case RTE_RELATION: + /* - * Grab the appropriate lock type for the relation, and - * do not release it until end of transaction. This protects - * the rewriter and planner against schema changes mid-query. + * Grab the appropriate lock type for the relation, and do not + * release it until end of transaction. This protects the + * rewriter and planner against schema changes mid-query. * - * If the relation is the query's result relation, then we - * need RowExclusiveLock. Otherwise, check to see if the - * relation is accessed FOR UPDATE/SHARE or not. We can't - * just grab AccessShareLock because then the executor - * would be trying to upgrade the lock, leading to possible - * deadlocks. + * If the relation is the query's result relation, then we need + * RowExclusiveLock. Otherwise, check to see if the relation + * is accessed FOR UPDATE/SHARE or not. We can't just grab + * AccessShareLock because then the executor would be trying + * to upgrade the lock, leading to possible deadlocks. */ if (rt_index == parsetree->resultRelation) lockmode = RowExclusiveLock; @@ -139,14 +139,15 @@ AcquireRewriteLocks(Query *parsetree) break; case RTE_JOIN: + /* - * Scan the join's alias var list to see if any columns - * have been dropped, and if so replace those Vars with - * NULL Consts. + * Scan the join's alias var list to see if any columns have + * been dropped, and if so replace those Vars with NULL + * Consts. * - * Since a join has only two inputs, we can expect to - * see multiple references to the same input RTE; optimize - * away multiple fetches. + * Since a join has only two inputs, we can expect to see + * multiple references to the same input RTE; optimize away + * multiple fetches. */ newaliasvars = NIL; curinputvarno = 0; @@ -159,19 +160,19 @@ AcquireRewriteLocks(Query *parsetree) * If the list item isn't a simple Var, then it must * represent a merged column, ie a USING column, and so it * couldn't possibly be dropped, since it's referenced in - * the join clause. (Conceivably it could also be a - * NULL constant already? But that's OK too.) + * the join clause. (Conceivably it could also be a NULL + * constant already? But that's OK too.) */ if (IsA(aliasvar, Var)) { /* * The elements of an alias list have to refer to - * earlier RTEs of the same rtable, because that's - * the order the planner builds things in. So we - * already processed the referenced RTE, and so it's - * safe to use get_rte_attribute_is_dropped on it. - * (This might not hold after rewriting or planning, - * but it's OK to assume here.) + * earlier RTEs of the same rtable, because that's the + * order the planner builds things in. So we already + * processed the referenced RTE, and so it's safe to + * use get_rte_attribute_is_dropped on it. (This might + * not hold after rewriting or planning, but it's OK + * to assume here.) */ Assert(aliasvar->varlevelsup == 0); if (aliasvar->varno != curinputvarno) @@ -200,6 +201,7 @@ AcquireRewriteLocks(Query *parsetree) break; case RTE_SUBQUERY: + /* * The subquery RTE itself is all right, but we have to * recurse to process the represented subquery. @@ -214,8 +216,8 @@ AcquireRewriteLocks(Query *parsetree) } /* - * Recurse into sublink subqueries, too. But we already did the ones - * in the rtable. + * Recurse into sublink subqueries, too. But we already did the ones in + * the rtable. */ if (parsetree->hasSubLinks) query_tree_walker(parsetree, acquireLocksOnSubLinks, NULL, @@ -266,8 +268,8 @@ rewriteRuleAction(Query *parsetree, Query **sub_action_ptr; /* - * Make modifiable copies of rule action and qual (what we're passed - * are the stored versions in the relcache; don't touch 'em!). + * Make modifiable copies of rule action and qual (what we're passed are + * the stored versions in the relcache; don't touch 'em!). */ rule_action = (Query *) copyObject(rule_action); rule_qual = (Node *) copyObject(rule_qual); @@ -283,12 +285,12 @@ rewriteRuleAction(Query *parsetree, new_varno = PRS2_NEW_VARNO + rt_length; /* - * Adjust rule action and qual to offset its varnos, so that we can - * merge its rtable with the main parsetree's rtable. + * Adjust rule action and qual to offset its varnos, so that we can merge + * its rtable with the main parsetree's rtable. * - * If the rule action is an INSERT...SELECT, the OLD/NEW rtable entries - * will be in the SELECT part, and we have to modify that rather than - * the top-level INSERT (kluge!). + * If the rule action is an INSERT...SELECT, the OLD/NEW rtable entries will + * be in the SELECT part, and we have to modify that rather than the + * top-level INSERT (kluge!). */ sub_action = getInsertSelectQuery(rule_action, &sub_action_ptr); @@ -303,50 +305,47 @@ rewriteRuleAction(Query *parsetree, /* * Generate expanded rtable consisting of main parsetree's rtable plus * rule action's rtable; this becomes the complete rtable for the rule - * action. Some of the entries may be unused after we finish - * rewriting, but we leave them all in place for two reasons: + * action. Some of the entries may be unused after we finish rewriting, + * but we leave them all in place for two reasons: * - * We'd have a much harder job to adjust the query's varnos if we - * selectively removed RT entries. + * We'd have a much harder job to adjust the query's varnos if we selectively + * removed RT entries. * - * If the rule is INSTEAD, then the original query won't be executed at - * all, and so its rtable must be preserved so that the executor will - * do the correct permissions checks on it. + * If the rule is INSTEAD, then the original query won't be executed at all, + * and so its rtable must be preserved so that the executor will do the + * correct permissions checks on it. * * RT entries that are not referenced in the completed jointree will be - * ignored by the planner, so they do not affect query semantics. But - * any permissions checks specified in them will be applied during - * executor startup (see ExecCheckRTEPerms()). This allows us to - * check that the caller has, say, insert-permission on a view, when - * the view is not semantically referenced at all in the resulting - * query. + * ignored by the planner, so they do not affect query semantics. But any + * permissions checks specified in them will be applied during executor + * startup (see ExecCheckRTEPerms()). This allows us to check that the + * caller has, say, insert-permission on a view, when the view is not + * semantically referenced at all in the resulting query. * - * When a rule is not INSTEAD, the permissions checks done on its copied - * RT entries will be redundant with those done during execution of - * the original query, but we don't bother to treat that case - * differently. + * When a rule is not INSTEAD, the permissions checks done on its copied RT + * entries will be redundant with those done during execution of the + * original query, but we don't bother to treat that case differently. * - * NOTE: because planner will destructively alter rtable, we must ensure - * that rule action's rtable is separate and shares no substructure - * with the main rtable. Hence do a deep copy here. + * NOTE: because planner will destructively alter rtable, we must ensure that + * rule action's rtable is separate and shares no substructure with the + * main rtable. Hence do a deep copy here. */ sub_action->rtable = list_concat((List *) copyObject(parsetree->rtable), sub_action->rtable); /* * Each rule action's jointree should be the main parsetree's jointree - * plus that rule's jointree, but usually *without* the original - * rtindex that we're replacing (if present, which it won't be for - * INSERT). Note that if the rule action refers to OLD, its jointree - * will add a reference to rt_index. If the rule action doesn't refer - * to OLD, but either the rule_qual or the user query quals do, then - * we need to keep the original rtindex in the jointree to provide - * data for the quals. We don't want the original rtindex to be - * joined twice, however, so avoid keeping it if the rule action - * mentions it. + * plus that rule's jointree, but usually *without* the original rtindex + * that we're replacing (if present, which it won't be for INSERT). Note + * that if the rule action refers to OLD, its jointree will add a + * reference to rt_index. If the rule action doesn't refer to OLD, but + * either the rule_qual or the user query quals do, then we need to keep + * the original rtindex in the jointree to provide data for the quals. We + * don't want the original rtindex to be joined twice, however, so avoid + * keeping it if the rule action mentions it. * - * As above, the action's jointree must not share substructure with the - * main parsetree's. + * As above, the action's jointree must not share substructure with the main + * parsetree's. */ if (sub_action->commandType != CMD_UTILITY) { @@ -357,15 +356,15 @@ rewriteRuleAction(Query *parsetree, keeporig = (!rangeTableEntry_used((Node *) sub_action->jointree, rt_index, 0)) && (rangeTableEntry_used(rule_qual, rt_index, 0) || - rangeTableEntry_used(parsetree->jointree->quals, rt_index, 0)); + rangeTableEntry_used(parsetree->jointree->quals, rt_index, 0)); newjointree = adjustJoinTreeList(parsetree, !keeporig, rt_index); if (newjointree != NIL) { /* - * If sub_action is a setop, manipulating its jointree will do - * no good at all, because the jointree is dummy. (Perhaps - * someday we could push the joining and quals down to the - * member statements of the setop?) + * If sub_action is a setop, manipulating its jointree will do no + * good at all, because the jointree is dummy. (Perhaps someday + * we could push the joining and quals down to the member + * statements of the setop?) */ if (sub_action->setOperations != NULL) ereport(ERROR, @@ -378,9 +377,9 @@ rewriteRuleAction(Query *parsetree, } /* - * Event Qualification forces copying of parsetree and splitting into - * two queries one w/rule_qual, one w/NOT rule_qual. Also add user - * query qual onto rule action + * Event Qualification forces copying of parsetree and splitting into two + * queries one w/rule_qual, one w/NOT rule_qual. Also add user query qual + * onto rule action */ AddQual(sub_action, rule_qual); @@ -390,9 +389,9 @@ rewriteRuleAction(Query *parsetree, * Rewrite new.attribute w/ right hand side of target-list entry for * appropriate field name in insert/update. * - * KLUGE ALERT: since ResolveNew returns a mutated copy, we can't just - * apply it to sub_action; we have to remember to update the sublink - * inside rule_action, too. + * KLUGE ALERT: since ResolveNew returns a mutated copy, we can't just apply + * it to sub_action; we have to remember to update the sublink inside + * rule_action, too. */ if ((event == CMD_INSERT || event == CMD_UPDATE) && sub_action->commandType != CMD_UTILITY) @@ -440,8 +439,7 @@ adjustJoinTreeList(Query *parsetree, bool removert, int rt_index) newjointree = list_delete_ptr(newjointree, rtr); /* - * foreach is safe because we exit loop after - * list_delete... + * foreach is safe because we exit loop after list_delete... */ break; } @@ -494,13 +492,13 @@ rewriteTargetList(Query *parsetree, Relation target_relation) ListCell *temp; /* - * We process the normal (non-junk) attributes by scanning the input - * tlist once and transferring TLEs into an array, then scanning the - * array to build an output tlist. This avoids O(N^2) behavior for - * large numbers of attributes. + * We process the normal (non-junk) attributes by scanning the input tlist + * once and transferring TLEs into an array, then scanning the array to + * build an output tlist. This avoids O(N^2) behavior for large numbers + * of attributes. * - * Junk attributes are tossed into a separate list during the same - * tlist scan, then appended to the reconstructed tlist. + * Junk attributes are tossed into a separate list during the same tlist + * scan, then appended to the reconstructed tlist. */ numattrs = RelationGetNumberOfAttributes(target_relation); new_tles = (TargetEntry **) palloc0(numattrs * sizeof(TargetEntry *)); @@ -531,11 +529,11 @@ rewriteTargetList(Query *parsetree, Relation target_relation) else { /* - * Copy all resjunk tlist entries to junk_tlist, and - * assign them resnos above the last real resno. + * Copy all resjunk tlist entries to junk_tlist, and assign them + * resnos above the last real resno. * - * Typical junk entries include ORDER BY or GROUP BY expressions - * (are these actually possible in an INSERT or UPDATE?), system + * Typical junk entries include ORDER BY or GROUP BY expressions (are + * these actually possible in an INSERT or UPDATE?), system * attribute references, etc. */ @@ -561,9 +559,9 @@ rewriteTargetList(Query *parsetree, Relation target_relation) continue; /* - * Handle the two cases where we need to insert a default - * expression: it's an INSERT and there's no tlist entry for the - * column, or the tlist entry is a DEFAULT placeholder node. + * Handle the two cases where we need to insert a default expression: + * it's an INSERT and there's no tlist entry for the column, or the + * tlist entry is a DEFAULT placeholder node. */ if ((new_tle == NULL && commandType == CMD_INSERT) || (new_tle && new_tle->expr && IsA(new_tle->expr, SetToDefault))) @@ -573,12 +571,11 @@ rewriteTargetList(Query *parsetree, Relation target_relation) new_expr = build_column_default(target_relation, attrno); /* - * If there is no default (ie, default is effectively NULL), - * we can omit the tlist entry in the INSERT case, since the - * planner can insert a NULL for itself, and there's no point - * in spending any more rewriter cycles on the entry. But in - * the UPDATE case we've got to explicitly set the column to - * NULL. + * If there is no default (ie, default is effectively NULL), we + * can omit the tlist entry in the INSERT case, since the planner + * can insert a NULL for itself, and there's no point in spending + * any more rewriter cycles on the entry. But in the UPDATE case + * we've got to explicitly set the column to NULL. */ if (!new_expr) { @@ -640,8 +637,7 @@ process_matched_tle(TargetEntry *src_tle, if (prior_tle == NULL) { /* - * Normal case where this is the first assignment to the - * attribute. + * Normal case where this is the first assignment to the attribute. */ return src_tle; } @@ -682,8 +678,7 @@ process_matched_tle(TargetEntry *src_tle, attrName))); /* - * Prior TLE could be a nest of assignments if we do this more than - * once. + * Prior TLE could be a nest of assignments if we do this more than once. */ priorbottom = prior_input; for (;;) @@ -713,10 +708,10 @@ process_matched_tle(TargetEntry *src_tle, memcpy(fstore, prior_expr, sizeof(FieldStore)); fstore->newvals = list_concat(list_copy(((FieldStore *) prior_expr)->newvals), - list_copy(((FieldStore *) src_expr)->newvals)); + list_copy(((FieldStore *) src_expr)->newvals)); fstore->fieldnums = list_concat(list_copy(((FieldStore *) prior_expr)->fieldnums), - list_copy(((FieldStore *) src_expr)->fieldnums)); + list_copy(((FieldStore *) src_expr)->fieldnums)); } else { @@ -809,8 +804,7 @@ build_column_default(Relation rel, int attrno) if (expr == NULL) { /* - * No per-column default, so look for a default for the type - * itself. + * No per-column default, so look for a default for the type itself. */ expr = get_typdefault(atttype); } @@ -821,8 +815,8 @@ build_column_default(Relation rel, int attrno) /* * Make sure the value is coerced to the target column type; this will * generally be true already, but there seem to be some corner cases - * involving domain defaults where it might not be true. This should - * match the parser's processing of non-defaulted expressions --- see + * involving domain defaults where it might not be true. This should match + * the parser's processing of non-defaulted expressions --- see * updateTargetListEntry(). */ exprtype = exprType(expr); @@ -840,7 +834,7 @@ build_column_default(Relation rel, int attrno) NameStr(att_tup->attname), format_type_be(atttype), format_type_be(exprtype)), - errhint("You will need to rewrite or cast the expression."))); + errhint("You will need to rewrite or cast the expression."))); return expr; } @@ -913,8 +907,8 @@ ApplyRetrieveRule(Query *parsetree, elog(ERROR, "cannot handle per-attribute ON SELECT rule"); /* - * Make a modifiable copy of the view query, and acquire needed locks - * on the relations it mentions. + * Make a modifiable copy of the view query, and acquire needed locks on + * the relations it mentions. */ rule_action = copyObject(linitial(rule->actions)); @@ -926,8 +920,8 @@ ApplyRetrieveRule(Query *parsetree, rule_action = fireRIRrules(rule_action, activeRIRs); /* - * VIEWs are really easy --- just plug the view query in as a - * subselect, replacing the relation's original RTE. + * VIEWs are really easy --- just plug the view query in as a subselect, + * replacing the relation's original RTE. */ rte = rt_fetch(rt_index, parsetree->rtable); @@ -937,8 +931,8 @@ ApplyRetrieveRule(Query *parsetree, rte->inh = false; /* must not be set for a subquery */ /* - * We move the view's permission check data down to its rangetable. - * The checks will actually be done against the *OLD* entry therein. + * We move the view's permission check data down to its rangetable. The + * checks will actually be done against the *OLD* entry therein. */ subrte = rt_fetch(PRS2_OLD_VARNO, rule_action->rtable); Assert(subrte->relid == relation->rd_id); @@ -954,9 +948,9 @@ ApplyRetrieveRule(Query *parsetree, if (list_member_int(parsetree->rowMarks, rt_index)) { /* - * Remove the view from the list of rels that will actually be - * marked FOR UPDATE/SHARE by the executor. It will still be access- - * checked for write access, though. + * Remove the view from the list of rels that will actually be marked + * FOR UPDATE/SHARE by the executor. It will still be access- checked + * for write access, though. */ parsetree->rowMarks = list_delete_int(parsetree->rowMarks, rt_index); @@ -989,7 +983,7 @@ markQueryForLocking(Query *qry, bool forUpdate, bool noWait, bool skipOldNew) if (forUpdate != qry->forUpdate) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot use both FOR UPDATE and FOR SHARE in one query"))); + errmsg("cannot use both FOR UPDATE and FOR SHARE in one query"))); if (noWait != qry->rowNoWait) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -1052,8 +1046,8 @@ fireRIRonSubLink(Node *node, List *activeRIRs) } /* - * Do NOT recurse into Query nodes, because fireRIRrules already - * processed subselects of subselects for us. + * Do NOT recurse into Query nodes, because fireRIRrules already processed + * subselects of subselects for us. */ return expression_tree_walker(node, fireRIRonSubLink, (void *) activeRIRs); @@ -1070,8 +1064,8 @@ fireRIRrules(Query *parsetree, List *activeRIRs) int rt_index; /* - * don't try to convert this into a foreach loop, because rtable list - * can get changed each time through... + * don't try to convert this into a foreach loop, because rtable list can + * get changed each time through... */ rt_index = 0; while (rt_index < list_length(parsetree->rtable)) @@ -1088,8 +1082,8 @@ fireRIRrules(Query *parsetree, List *activeRIRs) rte = rt_fetch(rt_index, parsetree->rtable); /* - * A subquery RTE can't have associated rules, so there's nothing - * to do to this level of the query, but we must recurse into the + * A subquery RTE can't have associated rules, so there's nothing to + * do to this level of the query, but we must recurse into the * subquery to expand any rule references in it. */ if (rte->rtekind == RTE_SUBQUERY) @@ -1108,8 +1102,8 @@ fireRIRrules(Query *parsetree, List *activeRIRs) * If the table is not referenced in the query, then we ignore it. * This prevents infinite expansion loop due to new rtable entries * inserted by expansion of a rule. A table is referenced if it is - * part of the join set (a source table), or is referenced by any - * Var nodes, or is the result table. + * part of the join set (a source table), or is referenced by any Var + * nodes, or is the result table. */ if (rt_index != parsetree->resultRelation && !rangeTableEntry_used((Node *) parsetree, rt_index, 0)) @@ -1181,8 +1175,8 @@ fireRIRrules(Query *parsetree, List *activeRIRs) } /* - * Recurse into sublink subqueries, too. But we already did the ones - * in the rtable. + * Recurse into sublink subqueries, too. But we already did the ones in + * the rtable. */ if (parsetree->hasSubLinks) query_tree_walker(parsetree, fireRIRonSubLink, (void *) activeRIRs, @@ -1217,8 +1211,8 @@ CopyAndAddInvertedQual(Query *parsetree, /* * In case there are subqueries in the qual, acquire necessary locks and * fix any deleted JOIN RTE entries. (This is somewhat redundant with - * rewriteRuleAction, but not entirely ... consider restructuring so - * that we only need to process the qual this way once.) + * rewriteRuleAction, but not entirely ... consider restructuring so that + * we only need to process the qual this way once.) */ (void) acquireLocksOnSubLinks(new_qual, NULL); @@ -1302,13 +1296,13 @@ fireRules(Query *parsetree, if (qsrc == QSRC_QUAL_INSTEAD_RULE) { /* - * If there are INSTEAD rules with qualifications, the - * original query is still performed. But all the negated rule - * qualifications of the INSTEAD rules are added so it does - * its actions only in cases where the rule quals of all - * INSTEAD rules are false. Think of it as the default action - * in a case. We save this in *qual_product so RewriteQuery() - * can add it to the query list after we mangled it up enough. + * If there are INSTEAD rules with qualifications, the original + * query is still performed. But all the negated rule + * qualifications of the INSTEAD rules are added so it does its + * actions only in cases where the rule quals of all INSTEAD rules + * are false. Think of it as the default action in a case. We save + * this in *qual_product so RewriteQuery() can add it to the query + * list after we mangled it up enough. * * If we have already found an unqualified INSTEAD rule, then * *qual_product won't be used, so don't bother building it. @@ -1364,9 +1358,9 @@ RewriteQuery(Query *parsetree, List *rewrite_events) /* * If the statement is an update, insert or delete - fire rules on it. * - * SELECT rules are handled later when we have all the queries that - * should get executed. Also, utilities aren't rewritten at all (do - * we still need that check?) + * SELECT rules are handled later when we have all the queries that should + * get executed. Also, utilities aren't rewritten at all (do we still + * need that check?) */ if (event != CMD_SELECT && event != CMD_UTILITY) { @@ -1387,10 +1381,9 @@ RewriteQuery(Query *parsetree, List *rewrite_events) rt_entry_relation = heap_open(rt_entry->relid, NoLock); /* - * If it's an INSERT or UPDATE, rewrite the targetlist into - * standard form. This will be needed by the planner anyway, and - * doing it now ensures that any references to NEW.field will - * behave sanely. + * If it's an INSERT or UPDATE, rewrite the targetlist into standard + * form. This will be needed by the planner anyway, and doing it now + * ensures that any references to NEW.field will behave sanely. */ if (event == CMD_INSERT || event == CMD_UPDATE) rewriteTargetList(parsetree, rt_entry_relation); @@ -1413,8 +1406,8 @@ RewriteQuery(Query *parsetree, List *rewrite_events) &qual_product); /* - * If we got any product queries, recursively rewrite them --- - * but first check for recursion! + * If we got any product queries, recursively rewrite them --- but + * first check for recursion! */ if (product_queries != NIL) { @@ -1427,9 +1420,9 @@ RewriteQuery(Query *parsetree, List *rewrite_events) if (rev->relation == RelationGetRelid(rt_entry_relation) && rev->event == event) ereport(ERROR, - (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("infinite recursion detected in rules for relation \"%s\"", - RelationGetRelationName(rt_entry_relation)))); + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("infinite recursion detected in rules for relation \"%s\"", + RelationGetRelationName(rt_entry_relation)))); } rev = (rewrite_event *) palloc(sizeof(rewrite_event)); @@ -1454,13 +1447,12 @@ RewriteQuery(Query *parsetree, List *rewrite_events) } /* - * For INSERTs, the original query is done first; for UPDATE/DELETE, - * it is done last. This is needed because update and delete rule - * actions might not do anything if they are invoked after the update - * or delete is performed. The command counter increment between the - * query executions makes the deleted (and maybe the updated) tuples - * disappear so the scans for them in the rule actions cannot find - * them. + * For INSERTs, the original query is done first; for UPDATE/DELETE, it is + * done last. This is needed because update and delete rule actions might + * not do anything if they are invoked after the update or delete is + * performed. The command counter increment between the query executions + * makes the deleted (and maybe the updated) tuples disappear so the scans + * for them in the rule actions cannot find them. * * If we found any unqualified INSTEAD, the original query is not done at * all, in any form. Otherwise, we add the modified form if qualified @@ -1569,19 +1561,18 @@ QueryRewrite(Query *parsetree) /* * Step 3 * - * Determine which, if any, of the resulting queries is supposed to set - * the command-result tag; and update the canSetTag fields - * accordingly. + * Determine which, if any, of the resulting queries is supposed to set the + * command-result tag; and update the canSetTag fields accordingly. * * If the original query is still in the list, it sets the command tag. - * Otherwise, the last INSTEAD query of the same kind as the original - * is allowed to set the tag. (Note these rules can leave us with no - * query setting the tag. The tcop code has to cope with this by - * setting up a default tag based on the original un-rewritten query.) + * Otherwise, the last INSTEAD query of the same kind as the original is + * allowed to set the tag. (Note these rules can leave us with no query + * setting the tag. The tcop code has to cope with this by setting up a + * default tag based on the original un-rewritten query.) * * The Asserts verify that at most one query in the result list is marked - * canSetTag. If we aren't checking asserts, we can fall out of the - * loop as soon as we find the original query. + * canSetTag. If we aren't checking asserts, we can fall out of the loop + * as soon as we find the original query. */ origCmdType = parsetree->commandType; foundOriginalQuery = false; diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index 353e4ca76f3..9e6bc4808e7 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.91 2005/06/04 19:19:42 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.92 2005/10/15 02:49:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -53,8 +53,8 @@ checkExprHasAggs(Node *node) context.sublevels_up = 0; /* - * Must be prepared to start with a Query or a bare expression tree; - * if it's a Query, we don't want to increment sublevels_up. + * Must be prepared to start with a Query or a bare expression tree; if + * it's a Query, we don't want to increment sublevels_up. */ return query_or_expression_tree_walker(node, checkExprHasAggs_walker, @@ -70,8 +70,7 @@ checkExprHasAggs_walker(Node *node, checkExprHasAggs_context *context) if (IsA(node, Aggref)) { if (((Aggref *) node)->agglevelsup == context->sublevels_up) - return true; /* abort the tree traversal and return - * true */ + return true; /* abort the tree traversal and return true */ /* else fall through to examine argument */ } if (IsA(node, Query)) @@ -113,8 +112,7 @@ checkExprHasSubLink_walker(Node *node, void *context) if (node == NULL) return false; if (IsA(node, SubLink)) - return true; /* abort the tree traversal and return - * true */ + return true; /* abort the tree traversal and return true */ return expression_tree_walker(node, checkExprHasSubLink_walker, context); } @@ -208,8 +206,8 @@ OffsetVarNodes(Node *node, int offset, int sublevels_up) context.sublevels_up = sublevels_up; /* - * Must be prepared to start with a Query or a bare expression tree; - * if it's a Query, go straight to query_tree_walker to make sure that + * Must be prepared to start with a Query or a bare expression tree; if + * it's a Query, go straight to query_tree_walker to make sure that * sublevels_up doesn't get incremented prematurely. */ if (node && IsA(node, Query)) @@ -217,11 +215,11 @@ OffsetVarNodes(Node *node, int offset, int sublevels_up) Query *qry = (Query *) node; /* - * If we are starting at a Query, and sublevels_up is zero, then - * we must also fix rangetable indexes in the Query itself --- - * namely resultRelation and rowMarks entries. sublevels_up - * cannot be zero when recursing into a subquery, so there's no - * need to have the same logic inside OffsetVarNodes_walker. + * If we are starting at a Query, and sublevels_up is zero, then we + * must also fix rangetable indexes in the Query itself --- namely + * resultRelation and rowMarks entries. sublevels_up cannot be zero + * when recursing into a subquery, so there's no need to have the same + * logic inside OffsetVarNodes_walker. */ if (sublevels_up == 0) { @@ -349,8 +347,8 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up) context.sublevels_up = sublevels_up; /* - * Must be prepared to start with a Query or a bare expression tree; - * if it's a Query, go straight to query_tree_walker to make sure that + * Must be prepared to start with a Query or a bare expression tree; if + * it's a Query, go straight to query_tree_walker to make sure that * sublevels_up doesn't get incremented prematurely. */ if (node && IsA(node, Query)) @@ -358,11 +356,11 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up) Query *qry = (Query *) node; /* - * If we are starting at a Query, and sublevels_up is zero, then - * we must also fix rangetable indexes in the Query itself --- - * namely resultRelation and rowMarks entries. sublevels_up - * cannot be zero when recursing into a subquery, so there's no - * need to have the same logic inside ChangeVarNodes_walker. + * If we are starting at a Query, and sublevels_up is zero, then we + * must also fix rangetable indexes in the Query itself --- namely + * resultRelation and rowMarks entries. sublevels_up cannot be zero + * when recursing into a subquery, so there's no need to have the same + * logic inside ChangeVarNodes_walker. */ if (sublevels_up == 0) { @@ -473,8 +471,8 @@ IncrementVarSublevelsUp(Node *node, int delta_sublevels_up, context.min_sublevels_up = min_sublevels_up; /* - * Must be prepared to start with a Query or a bare expression tree; - * if it's a Query, we don't want to increment sublevels_up. + * Must be prepared to start with a Query or a bare expression tree; if + * it's a Query, we don't want to increment sublevels_up. */ query_or_expression_tree_walker(node, IncrementVarSublevelsUp_walker, @@ -562,8 +560,8 @@ rangeTableEntry_used(Node *node, int rt_index, int sublevels_up) context.sublevels_up = sublevels_up; /* - * Must be prepared to start with a Query or a bare expression tree; - * if it's a Query, we don't want to increment sublevels_up. + * Must be prepared to start with a Query or a bare expression tree; if + * it's a Query, we don't want to increment sublevels_up. */ return query_or_expression_tree_walker(node, rangeTableEntry_used_walker, @@ -626,8 +624,8 @@ attribute_used(Node *node, int rt_index, int attno, int sublevels_up) context.sublevels_up = sublevels_up; /* - * Must be prepared to start with a Query or a bare expression tree; - * if it's a Query, we don't want to increment sublevels_up. + * Must be prepared to start with a Query or a bare expression tree; if + * it's a Query, we don't want to increment sublevels_up. */ return query_or_expression_tree_walker(node, attribute_used_walker, @@ -671,10 +669,10 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr) * they've been pushed down to the SELECT. */ if (list_length(parsetree->rtable) >= 2 && - strcmp(rt_fetch(PRS2_OLD_VARNO, parsetree->rtable)->eref->aliasname, - "*OLD*") == 0 && - strcmp(rt_fetch(PRS2_NEW_VARNO, parsetree->rtable)->eref->aliasname, - "*NEW*") == 0) + strcmp(rt_fetch(PRS2_OLD_VARNO, parsetree->rtable)->eref->aliasname, + "*OLD*") == 0 && + strcmp(rt_fetch(PRS2_NEW_VARNO, parsetree->rtable)->eref->aliasname, + "*NEW*") == 0) return parsetree; Assert(parsetree->jointree && IsA(parsetree->jointree, FromExpr)); if (list_length(parsetree->jointree->fromlist) != 1) @@ -687,10 +685,10 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr) selectquery->commandType == CMD_SELECT)) elog(ERROR, "expected to find SELECT subquery"); if (list_length(selectquery->rtable) >= 2 && - strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname, - "*OLD*") == 0 && - strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->aliasname, - "*NEW*") == 0) + strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname, + "*OLD*") == 0 && + strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->aliasname, + "*NEW*") == 0) { if (subquery_ptr) *subquery_ptr = &(selectrte->subquery); @@ -717,30 +715,30 @@ AddQual(Query *parsetree, Node *qual) /* * There's noplace to put the qual on a utility statement. * - * If it's a NOTIFY, silently ignore the qual; this means that the - * NOTIFY will execute, whether or not there are any qualifying - * rows. While clearly wrong, this is much more useful than - * refusing to execute the rule at all, and extra NOTIFY events - * are harmless for typical uses of NOTIFY. + * If it's a NOTIFY, silently ignore the qual; this means that the NOTIFY + * will execute, whether or not there are any qualifying rows. While + * clearly wrong, this is much more useful than refusing to execute + * the rule at all, and extra NOTIFY events are harmless for typical + * uses of NOTIFY. * * If it isn't a NOTIFY, error out, since unconditional execution of - * other utility stmts is unlikely to be wanted. (This case is - * not currently allowed anyway, but keep the test for safety.) + * other utility stmts is unlikely to be wanted. (This case is not + * currently allowed anyway, but keep the test for safety.) */ if (parsetree->utilityStmt && IsA(parsetree->utilityStmt, NotifyStmt)) return; else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("conditional utility statements are not implemented"))); + errmsg("conditional utility statements are not implemented"))); } if (parsetree->setOperations != NULL) { /* - * There's noplace to put the qual on a setop statement, either. - * (This could be fixed, but right now the planner simply ignores - * any qual condition on a setop query.) + * There's noplace to put the qual on a setop statement, either. (This + * could be fixed, but right now the planner simply ignores any qual + * condition on a setop query.) */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -759,8 +757,8 @@ AddQual(Query *parsetree, Node *qual) Assert(!checkExprHasAggs(copy)); /* - * Make sure query is marked correctly if added qual has sublinks. - * Need not search qual when query is already marked. + * Make sure query is marked correctly if added qual has sublinks. Need + * not search qual when query is already marked. */ if (!parsetree->hasSubLinks) parsetree->hasSubLinks = checkExprHasSubLink(copy); @@ -880,9 +878,9 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context) /* * If generating an expansion for a var of a named rowtype - * (ie, this is a plain relation RTE), then we must - * include dummy items for dropped columns. If the var is - * RECORD (ie, this is a JOIN), then omit dropped columns. + * (ie, this is a plain relation RTE), then we must include + * dummy items for dropped columns. If the var is RECORD (ie, + * this is a JOIN), then omit dropped columns. */ expandRTE(context->target_rte, this_varno, this_varlevelsup, @@ -943,8 +941,8 @@ ResolveNew(Node *node, int target_varno, int sublevels_up, context.inserted_sublink = false; /* - * Must be prepared to start with a Query or a bare expression tree; - * if it's a Query, we don't want to increment sublevels_up. + * Must be prepared to start with a Query or a bare expression tree; if + * it's a Query, we don't want to increment sublevels_up. */ return query_or_expression_tree_mutator(node, ResolveNew_mutator, diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c index f06d23cc322..900b3489df0 100644 --- a/src/backend/rewrite/rewriteRemove.c +++ b/src/backend/rewrite/rewriteRemove.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.62 2005/04/14 20:03:25 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.63 2005/10/15 02:49:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -117,10 +117,10 @@ RemoveRewriteRuleById(Oid ruleOid) elog(ERROR, "could not find tuple for rule %u", ruleOid); /* - * We had better grab AccessExclusiveLock so that we know no other - * rule additions/deletions are going on for this relation. Else we - * cannot set relhasrules correctly. Besides, we don't want to be - * changing the ruleset while queries are executing on the rel. + * We had better grab AccessExclusiveLock so that we know no other rule + * additions/deletions are going on for this relation. Else we cannot set + * relhasrules correctly. Besides, we don't want to be changing the + * ruleset while queries are executing on the rel. */ eventRelationOid = ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class; event_relation = heap_open(eventRelationOid, AccessExclusiveLock); diff --git a/src/backend/rewrite/rewriteSupport.c b/src/backend/rewrite/rewriteSupport.c index 8fd3bba7cde..6150c904d7e 100644 --- a/src/backend/rewrite/rewriteSupport.c +++ b/src/backend/rewrite/rewriteSupport.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteSupport.c,v 1.61 2005/04/14 20:03:25 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteSupport.c,v 1.62 2005/10/15 02:49:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -56,8 +56,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules, Form_pg_class classForm; /* - * Find the tuple to update in pg_class, using syscache for the - * lookup. + * Find the tuple to update in pg_class, using syscache for the lookup. */ relationRelation = heap_open(RelationRelationId, RowExclusiveLock); tuple = SearchSysCacheCopy(RELOID, |
