mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Make a code-cleanup pass over the collations patch.
This patch is almost entirely cosmetic --- mostly cleaning up a lot of neglected comments, and fixing code layout problems in places where the patch made lines too long and then pgindent did weird things with that. I did find a bug-of-omission in equalTupleDescs().
This commit is contained in:
@ -1357,9 +1357,9 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
|
||||
|
||||
/*
|
||||
* Generate dummy targetlist for outer query using column names of
|
||||
* leftmost select and common datatypes of topmost set operation. Also
|
||||
* make lists of the dummy vars and their names for use in parsing ORDER
|
||||
* BY.
|
||||
* leftmost select and common datatypes/collations of topmost set
|
||||
* operation. Also make lists of the dummy vars and their names for use
|
||||
* in parsing ORDER BY.
|
||||
*
|
||||
* Note: we use leftmostRTI as the varno of the dummy variables. It
|
||||
* shouldn't matter too much which RT index they have, as long as they
|
||||
@ -1371,7 +1371,9 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
|
||||
targetnames = NIL;
|
||||
left_tlist = list_head(leftmostQuery->targetList);
|
||||
|
||||
forthree(lct, sostmt->colTypes, lcm, sostmt->colTypmods, lcc, sostmt->colCollations)
|
||||
forthree(lct, sostmt->colTypes,
|
||||
lcm, sostmt->colTypmods,
|
||||
lcc, sostmt->colCollations)
|
||||
{
|
||||
Oid colType = lfirst_oid(lct);
|
||||
int32 colTypmod = lfirst_int(lcm);
|
||||
|
@ -286,10 +286,10 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Verify that the previously determined output column types match
|
||||
* what the query really produced. We have to check this because the
|
||||
* recursive term could have overridden the non-recursive term, and we
|
||||
* don't have any easy way to fix that.
|
||||
* Verify that the previously determined output column types and
|
||||
* collations match what the query really produced. We have to check
|
||||
* this because the recursive term could have overridden the
|
||||
* non-recursive term, and we don't have any easy way to fix that.
|
||||
*/
|
||||
ListCell *lctlist,
|
||||
*lctyp,
|
||||
@ -366,11 +366,11 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist)
|
||||
Assert(cte->ctecolnames == NIL);
|
||||
|
||||
/*
|
||||
* We need to determine column names and types. The alias column names
|
||||
* override anything coming from the query itself. (Note: the SQL spec
|
||||
* says that the alias list must be empty or exactly as long as the output
|
||||
* column set; but we allow it to be shorter for consistency with Alias
|
||||
* handling.)
|
||||
* We need to determine column names, types, and collations. The alias
|
||||
* column names override anything coming from the query itself. (Note:
|
||||
* the SQL spec says that the alias list must be empty or exactly as long
|
||||
* as the output column set; but we allow it to be shorter for consistency
|
||||
* with Alias handling.)
|
||||
*/
|
||||
cte->ctecolnames = copyObject(cte->aliascolnames);
|
||||
cte->ctecoltypes = cte->ctecoltypmods = cte->ctecolcollations = NIL;
|
||||
|
@ -1174,7 +1174,8 @@ addRangeTableEntryForFunction(ParseState *pstate,
|
||||
eref->colnames = lappend(eref->colnames, makeString(attrname));
|
||||
rte->funccoltypes = lappend_oid(rte->funccoltypes, attrtype);
|
||||
rte->funccoltypmods = lappend_int(rte->funccoltypmods, attrtypmod);
|
||||
rte->funccolcollations = lappend_oid(rte->funccolcollations, attrcollation);
|
||||
rte->funccolcollations = lappend_oid(rte->funccolcollations,
|
||||
attrcollation);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1902,7 +1903,8 @@ expandTupleDesc(TupleDesc tupdesc, Alias *eref,
|
||||
Var *varnode;
|
||||
|
||||
varnode = makeVar(rtindex, attr->attnum,
|
||||
attr->atttypid, attr->atttypmod, attr->attcollation,
|
||||
attr->atttypid, attr->atttypmod,
|
||||
attr->attcollation,
|
||||
sublevels_up);
|
||||
varnode->location = location;
|
||||
|
||||
@ -2009,7 +2011,7 @@ get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
|
||||
|
||||
/*
|
||||
* get_rte_attribute_type
|
||||
* Get attribute type information from a RangeTblEntry
|
||||
* Get attribute type/typmod/collation information from a RangeTblEntry
|
||||
*/
|
||||
void
|
||||
get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
|
||||
|
@ -372,7 +372,7 @@ transformAssignedExpr(ParseState *pstate,
|
||||
Oid type_id; /* type of value provided */
|
||||
Oid attrtype; /* type of target column */
|
||||
int32 attrtypmod;
|
||||
Oid attrcollation;
|
||||
Oid attrcollation; /* collation of target column */
|
||||
Relation rd = pstate->p_target_relation;
|
||||
|
||||
Assert(rd != NULL);
|
||||
@ -388,11 +388,12 @@ transformAssignedExpr(ParseState *pstate,
|
||||
|
||||
/*
|
||||
* If the expression is a DEFAULT placeholder, insert the attribute's
|
||||
* type/typmod into it so that exprType will report the right things. (We
|
||||
* expect that the eventually substituted default expression will in fact
|
||||
* have this type and typmod.) Also, reject trying to update a subfield
|
||||
* or array element with DEFAULT, since there can't be any default for
|
||||
* portions of a column.
|
||||
* type/typmod/collation into it so that exprType etc will report the
|
||||
* right things. (We expect that the eventually substituted default
|
||||
* expression will in fact have this type and typmod. The collation
|
||||
* likely doesn't matter, but let's set it correctly anyway.) Also,
|
||||
* reject trying to update a subfield or array element with DEFAULT, since
|
||||
* there can't be any default for portions of a column.
|
||||
*/
|
||||
if (expr && IsA(expr, SetToDefault))
|
||||
{
|
||||
|
Reference in New Issue
Block a user