#include "parser/parse_node.h"
Go to the source code of this file.
Functions | |
void | assign_query_collations (ParseState *pstate, Query *query) |
void | assign_list_collations (ParseState *pstate, List *exprs) |
void | assign_expr_collations (ParseState *pstate, Node *expr) |
Oid | select_common_collation (ParseState *pstate, List *exprs, bool none_ok) |
void assign_expr_collations | ( | ParseState * | pstate, | |
Node * | expr | |||
) |
Definition at line 163 of file parse_collate.c.
References assign_collations_walker(), assign_collations_context::collation, assign_collations_context::location, assign_collations_context::pstate, and assign_collations_context::strength.
Referenced by assign_collations_walker(), assign_list_collations(), assign_query_collations_walker(), ATPrepAlterColumnType(), buildMergedJoinVar(), cookConstraint(), cookDefault(), CreateTrigger(), domainAddConstraint(), EvaluateParams(), examine_parameter_list(), transformCaseExpr(), transformIndexStmt(), transformRangeFunction(), and transformRuleStmt().
{ assign_collations_context context; /* initialize context for tree walk */ context.pstate = pstate; context.collation = InvalidOid; context.strength = COLLATE_NONE; context.location = -1; /* and away we go */ (void) assign_collations_walker(expr, &context); }
void assign_list_collations | ( | ParseState * | pstate, | |
List * | exprs | |||
) |
Definition at line 141 of file parse_collate.c.
References assign_expr_collations(), and lfirst.
Referenced by assign_collations_walker(), and assign_query_collations_walker().
{ ListCell *lc; foreach(lc, exprs) { Node *node = (Node *) lfirst(lc); assign_expr_collations(pstate, node); } }
void assign_query_collations | ( | ParseState * | pstate, | |
Query * | query | |||
) |
Definition at line 87 of file parse_collate.c.
References assign_query_collations_walker(), QTW_IGNORE_RANGE_TABLE, and query_tree_walker().
Referenced by transformDeleteStmt(), transformSelectStmt(), transformSetOperationStmt(), transformUpdateStmt(), and transformValuesClause().
{ /* * We just use query_tree_walker() to visit all the contained expressions. * We can skip the rangetable and CTE subqueries, though, since RTEs and * subqueries had better have been processed already (else Vars referring * to them would not get created with the right collation). */ (void) query_tree_walker(query, assign_query_collations_walker, (void *) pstate, QTW_IGNORE_RANGE_TABLE | QTW_IGNORE_CTE_SUBQUERIES); }
Oid select_common_collation | ( | ParseState * | pstate, | |
List * | exprs, | |||
bool | none_ok | |||
) |
Definition at line 194 of file parse_collate.c.
References assign_collations_walker(), COLLATE_CONFLICT, assign_collations_context::collation, assign_collations_context::collation2, ereport, errcode(), errhint(), errmsg(), ERROR, get_collation_name(), assign_collations_context::location, assign_collations_context::location2, parser_errposition(), assign_collations_context::pstate, and assign_collations_context::strength.
Referenced by assign_collations_walker(), transformSetOperationTree(), and transformValuesClause().
{ assign_collations_context context; /* initialize context for tree walk */ context.pstate = pstate; context.collation = InvalidOid; context.strength = COLLATE_NONE; context.location = -1; /* and away we go */ (void) assign_collations_walker((Node *) exprs, &context); /* deal with collation conflict */ if (context.strength == COLLATE_CONFLICT) { if (none_ok) return InvalidOid; ereport(ERROR, (errcode(ERRCODE_COLLATION_MISMATCH), errmsg("collation mismatch between implicit collations \"%s\" and \"%s\"", get_collation_name(context.collation), get_collation_name(context.collation2)), errhint("You can choose the collation by applying the COLLATE clause to one or both expressions."), parser_errposition(context.pstate, context.location2))); } /* * Note: if strength is still COLLATE_NONE, we'll return InvalidOid, but * that's okay because it must mean none of the expressions returned * collatable datatypes. */ return context.collation; }