mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Pgindent run for 8.0.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.97 2004/08/29 04:12:46 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.98 2004/08/29 05:06:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -245,7 +245,7 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
*/
|
||||
if (event_type == CMD_SELECT)
|
||||
{
|
||||
ListCell *tllist;
|
||||
ListCell *tllist;
|
||||
int i;
|
||||
|
||||
/*
|
||||
@@ -272,7 +272,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, ...
|
||||
@@ -404,28 +404,28 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
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)));
|
||||
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;
|
||||
}
|
||||
@@ -441,8 +441,8 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
* 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.
|
||||
* rtable entries. We have to look at event_qual as well, in case it
|
||||
* contains sublinks.
|
||||
*/
|
||||
foreach(l, action)
|
||||
{
|
||||
@@ -502,7 +502,7 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
* Note: for a view (ON SELECT rule), the checkAsUser field of the *OLD*
|
||||
* RTE entry will be overridden when the view rule is expanded, and the
|
||||
* checkAsUser field of the *NEW* entry is irrelevant because that entry's
|
||||
* requiredPerms bits will always be zero. However, for other types of rules
|
||||
* requiredPerms bits will always be zero. However, for other types of rules
|
||||
* it's important to set these fields to match the rule owner. So we just set
|
||||
* them always.
|
||||
*/
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.143 2004/08/29 04:12:47 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.144 2004/08/29 05:06:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -48,8 +48,8 @@ static Query *rewriteRuleAction(Query *parsetree,
|
||||
static List *adjustJoinTreeList(Query *parsetree, bool removert, int rt_index);
|
||||
static void rewriteTargetList(Query *parsetree, Relation target_relation);
|
||||
static TargetEntry *process_matched_tle(TargetEntry *src_tle,
|
||||
TargetEntry *prior_tle,
|
||||
const char *attrName);
|
||||
TargetEntry *prior_tle,
|
||||
const char *attrName);
|
||||
static Node *get_assignment_input(Node *node);
|
||||
static void markQueryForUpdate(Query *qry, bool skipOldNew);
|
||||
static List *matchLocks(CmdType event, RuleLock *rulelocks,
|
||||
@@ -110,30 +110,32 @@ rewriteRuleAction(Query *parsetree,
|
||||
* 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.
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
sub_action->rtable = list_concat((List *) copyObject(parsetree->rtable),
|
||||
sub_action->rtable);
|
||||
sub_action->rtable);
|
||||
|
||||
/*
|
||||
* Each rule action's jointree should be the main parsetree's jointree
|
||||
@@ -251,7 +253,11 @@ adjustJoinTreeList(Query *parsetree, bool removert, int rt_index)
|
||||
rtr->rtindex == 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;
|
||||
}
|
||||
}
|
||||
@@ -469,7 +475,7 @@ process_matched_tle(TargetEntry *src_tle,
|
||||
* assignments appear to occur left-to-right.
|
||||
*
|
||||
* For FieldStore, instead of nesting we can generate a single
|
||||
* FieldStore with multiple target fields. We must nest when
|
||||
* FieldStore with multiple target fields. We must nest when
|
||||
* ArrayRefs are involved though.
|
||||
*----------
|
||||
*/
|
||||
@@ -492,7 +498,7 @@ process_matched_tle(TargetEntry *src_tle,
|
||||
priorbottom = prior_input;
|
||||
for (;;)
|
||||
{
|
||||
Node *newbottom = get_assignment_input(priorbottom);
|
||||
Node *newbottom = get_assignment_input(priorbottom);
|
||||
|
||||
if (newbottom == NULL)
|
||||
break; /* found the original Var reference */
|
||||
@@ -509,7 +515,7 @@ process_matched_tle(TargetEntry *src_tle,
|
||||
*/
|
||||
if (IsA(src_expr, FieldStore))
|
||||
{
|
||||
FieldStore *fstore = makeNode(FieldStore);
|
||||
FieldStore *fstore = makeNode(FieldStore);
|
||||
|
||||
if (IsA(prior_expr, FieldStore))
|
||||
{
|
||||
@@ -517,10 +523,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
|
||||
{
|
||||
@@ -1233,8 +1239,8 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
|
||||
*/
|
||||
if (product_queries != NIL)
|
||||
{
|
||||
ListCell *n;
|
||||
rewrite_event *rev;
|
||||
ListCell *n;
|
||||
rewrite_event *rev;
|
||||
|
||||
foreach(n, rewrite_events)
|
||||
{
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.87 2004/08/29 04:12:47 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.88 2004/08/29 05:06:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -856,7 +856,7 @@ AddInvertedQual(Query *parsetree, Node *qual)
|
||||
* The caller must also provide target_rtable, the rangetable containing
|
||||
* the target relation (which must be described by the target_varno'th
|
||||
* RTE in that list). This is needed to handle whole-row Vars referencing
|
||||
* the target. We expand such Vars into RowExpr constructs.
|
||||
* the target. We expand such Vars into RowExpr constructs.
|
||||
*
|
||||
* Note: the business with inserted_sublink is needed to update hasSubLinks
|
||||
* in subqueries when the replacement adds a subquery inside a subquery.
|
||||
@@ -932,14 +932,14 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
|
||||
if (var->varattno == InvalidAttrNumber)
|
||||
{
|
||||
/* Must expand whole-tuple reference into RowExpr */
|
||||
RowExpr *rowexpr;
|
||||
List *fields;
|
||||
RowExpr *rowexpr;
|
||||
List *fields;
|
||||
|
||||
/*
|
||||
* 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_rtable, this_varno, this_varlevelsup,
|
||||
(var->vartype != RECORDOID),
|
||||
|
Reference in New Issue
Block a user