mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Revise collation derivation method and expression-tree representation.
All expression nodes now have an explicit output-collation field, unless they are known to only return a noncollatable data type (such as boolean or record). Also, nodes that can invoke collation-aware functions store a separate field that is the collation value to pass to the function. This avoids confusion that arises when a function has collatable inputs and noncollatable output type, or vice versa. Also, replace the parser's on-the-fly collation assignment method with a post-pass over the completed expression tree. This allows us to use a more complex (and hopefully more nearly spec-compliant) assignment rule without paying for it in extra storage in every expression node. Fix assorted bugs in the planner's handling of collations by making collation one of the defining properties of an EquivalenceClass and by converting CollateExprs into discardable RelabelType nodes during expression preprocessing.
This commit is contained in:
@@ -36,7 +36,8 @@ typedef struct
|
||||
|
||||
|
||||
extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
|
||||
Expr *leftop, Expr *rightop);
|
||||
Expr *leftop, Expr *rightop,
|
||||
Oid opcollid, Oid inputcollid);
|
||||
extern Node *get_leftop(Expr *clause);
|
||||
extern Node *get_rightop(Expr *clause);
|
||||
|
||||
|
||||
@@ -111,11 +111,14 @@ extern bool have_join_order_restriction(PlannerInfo *root,
|
||||
*/
|
||||
extern bool process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo,
|
||||
bool below_outer_join);
|
||||
extern Expr *canonicalize_ec_expression(Expr *expr,
|
||||
Oid req_type, Oid req_collation);
|
||||
extern void reconsider_outer_join_clauses(PlannerInfo *root);
|
||||
extern EquivalenceClass *get_eclass_for_sort_expr(PlannerInfo *root,
|
||||
Expr *expr,
|
||||
Oid expr_datatype,
|
||||
List *opfamilies,
|
||||
Oid opcintype,
|
||||
Oid collation,
|
||||
Index sortref,
|
||||
bool create_it);
|
||||
extern void generate_base_implied_equalities(PlannerInfo *root);
|
||||
|
||||
@@ -98,12 +98,14 @@ extern void distribute_restrictinfo_to_rels(PlannerInfo *root,
|
||||
RestrictInfo *restrictinfo);
|
||||
extern void process_implied_equality(PlannerInfo *root,
|
||||
Oid opno,
|
||||
Oid collation,
|
||||
Expr *item1,
|
||||
Expr *item2,
|
||||
Relids qualscope,
|
||||
bool below_outer_join,
|
||||
bool both_const);
|
||||
extern RestrictInfo *build_implied_join_equality(Oid opno,
|
||||
Oid collation,
|
||||
Expr *item1,
|
||||
Expr *item2,
|
||||
Relids qualscope);
|
||||
|
||||
Reference in New Issue
Block a user