1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +03:00

Standard pgindent run for 8.1.

This commit is contained in:
Bruce Momjian
2005-10-15 02:49:52 +00:00
parent 790c01d280
commit 1dc3498251
770 changed files with 34334 additions and 32507 deletions

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/prep/preptlist.c,v 1.77 2005/06/05 22:32:56 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/prep/preptlist.c,v 1.78 2005/10/15 02:49:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,10 +45,10 @@ static List *expand_targetlist(List *tlist, int command_type,
List *
preprocess_targetlist(PlannerInfo *root, List *tlist)
{
Query *parse = root->parse;
int result_relation = parse->resultRelation;
List *range_table = parse->rtable;
CmdType command_type = parse->commandType;
Query *parse = root->parse;
int result_relation = parse->resultRelation;
List *range_table = parse->rtable;
CmdType command_type = parse->commandType;
/*
* Sanity check: if there is a result relation, it'd better be a real
@@ -63,20 +63,20 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
}
/*
* for heap_formtuple to work, the targetlist must match the exact
* order of the attributes. We also need to fill in any missing
* attributes. -ay 10/94
* for heap_formtuple to work, the targetlist must match the exact order
* of the attributes. We also need to fill in any missing attributes.
* -ay 10/94
*/
if (command_type == CMD_INSERT || command_type == CMD_UPDATE)
tlist = expand_targetlist(tlist, command_type,
result_relation, range_table);
/*
* for "update" and "delete" queries, add ctid of the result relation
* into the target list so that the ctid will propagate through
* execution and ExecutePlan() will be able to identify the right
* tuple to replace or delete. This extra field is marked "junk" so
* that it is not stored back into the tuple.
* for "update" and "delete" queries, add ctid of the result relation into
* the target list so that the ctid will propagate through execution and
* ExecutePlan() will be able to identify the right tuple to replace or
* delete. This extra field is marked "junk" so that it is not stored
* back into the tuple.
*/
if (command_type == CMD_UPDATE || command_type == CMD_DELETE)
{
@@ -92,9 +92,9 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
true);
/*
* For an UPDATE, expand_targetlist already created a fresh tlist.
* For DELETE, better do a listCopy so that we don't destructively
* modify the original tlist (is this really necessary?).
* For an UPDATE, expand_targetlist already created a fresh tlist. For
* DELETE, better do a listCopy so that we don't destructively modify
* the original tlist (is this really necessary?).
*/
if (command_type == CMD_DELETE)
tlist = list_copy(tlist);
@@ -103,31 +103,28 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
}
/*
* Add TID targets for rels selected FOR UPDATE/SHARE. The executor
* uses the TID to know which rows to lock, much as for UPDATE or
* DELETE.
* Add TID targets for rels selected FOR UPDATE/SHARE. The executor uses
* the TID to know which rows to lock, much as for UPDATE or DELETE.
*/
if (parse->rowMarks)
{
ListCell *l;
/*
* We've got trouble if the FOR UPDATE/SHARE appears inside
* grouping, since grouping renders a reference to individual
* tuple CTIDs invalid. This is also checked at parse time,
* but that's insufficient because of rule substitution, query
* pullup, etc.
* We've got trouble if the FOR UPDATE/SHARE appears inside grouping,
* since grouping renders a reference to individual tuple CTIDs
* invalid. This is also checked at parse time, but that's
* insufficient because of rule substitution, query pullup, etc.
*/
CheckSelectLocking(parse, parse->forUpdate);
/*
* Currently the executor only supports FOR UPDATE/SHARE at top
* level
* Currently the executor only supports FOR UPDATE/SHARE at top level
*/
if (PlannerQueryLevel > 1)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE is not allowed in subqueries")));
errmsg("SELECT FOR UPDATE/SHARE is not allowed in subqueries")));
foreach(l, parse->rowMarks)
{
@@ -185,14 +182,13 @@ expand_targetlist(List *tlist, int command_type,
tlist_item = list_head(tlist);
/*
* The rewriter should have already ensured that the TLEs are in
* correct order; but we have to insert TLEs for any missing
* attributes.
* The rewriter should have already ensured that the TLEs are in correct
* order; but we have to insert TLEs for any missing attributes.
*
* Scan the tuple description in the relation's relcache entry to make
* sure we have all the user attributes in the right order. We assume
* that the rewriter already acquired at least AccessShareLock on the
* relation, so we need no lock here.
* Scan the tuple description in the relation's relcache entry to make sure
* we have all the user attributes in the right order. We assume that the
* rewriter already acquired at least AccessShareLock on the relation, so
* we need no lock here.
*/
rel = heap_open(getrelid(result_relation, range_table), NoLock);
@@ -220,23 +216,22 @@ expand_targetlist(List *tlist, int command_type,
* Didn't find a matching tlist entry, so make one.
*
* For INSERT, generate a NULL constant. (We assume the rewriter
* would have inserted any available default value.) Also, if
* the column isn't dropped, apply any domain constraints that
* might exist --- this is to catch domain NOT NULL.
* would have inserted any available default value.) Also, if the
* column isn't dropped, apply any domain constraints that might
* exist --- this is to catch domain NOT NULL.
*
* For UPDATE, generate a Var reference to the existing value of
* the attribute, so that it gets copied to the new tuple. But
* generate a NULL for dropped columns (we want to drop any
* old values).
* For UPDATE, generate a Var reference to the existing value of the
* attribute, so that it gets copied to the new tuple. But
* generate a NULL for dropped columns (we want to drop any old
* values).
*
* When generating a NULL constant for a dropped column, we label
* it INT4 (any other guaranteed-to-exist datatype would do as
* well). We can't label it with the dropped column's
* datatype since that might not exist anymore. It does not
* really matter what we claim the type is, since NULL is NULL
* --- its representation is datatype-independent. This could
* perhaps confuse code comparing the finished plan to the
* target relation, however.
* When generating a NULL constant for a dropped column, we label it
* INT4 (any other guaranteed-to-exist datatype would do as well).
* We can't label it with the dropped column's datatype since that
* might not exist anymore. It does not really matter what we
* claim the type is, since NULL is NULL --- its representation is
* datatype-independent. This could perhaps confuse code
* comparing the finished plan to the target relation, however.
*/
Oid atttype = att_tup->atttypid;
int32 atttypmod = att_tup->atttypmod;
@@ -305,12 +300,12 @@ expand_targetlist(List *tlist, int command_type,
}
/*
* The remaining tlist entries should be resjunk; append them all to
* the end of the new tlist, making sure they have resnos higher than
* the last real attribute. (Note: although the rewriter already did
* such renumbering, we have to do it again here in case we are doing
* an UPDATE in a table with dropped columns, or an inheritance child
* table with extra columns.)
* The remaining tlist entries should be resjunk; append them all to the
* end of the new tlist, making sure they have resnos higher than the last
* real attribute. (Note: although the rewriter already did such
* renumbering, we have to do it again here in case we are doing an UPDATE
* in a table with dropped columns, or an inheritance child table with
* extra columns.)
*/
while (tlist_item)
{