MCPcopy Create free account
hub / github.com/apache/cloudberry / exprCollation

Function exprCollation

src/backend/nodes/nodeFuncs.c:781–1003  ·  view source on GitHub ↗

* exprCollation - * returns the Oid of the collation of the expression's result. * * Note: expression nodes that can invoke functions generally have an * "inputcollid" field, which is what the function should use as collation. * That is the resolved common collation of the node's inputs. It is often * but not always the same as the result collation; in particular, if the * function produ

Source from the content-addressed store, hash-verified

779 * or vice versa, the two are different.
780 */
781Oid
782exprCollation(const Node *expr)
783{
784 Oid coll;
785
786 if (!expr)
787 return InvalidOid;
788
789 switch (nodeTag(expr))
790 {
791 case T_Var:
792 coll = ((const Var *) expr)->varcollid;
793 break;
794 case T_Const:
795 coll = ((const Const *) expr)->constcollid;
796 break;
797 case T_Param:
798 coll = ((const Param *) expr)->paramcollid;
799 break;
800 case T_Aggref:
801 coll = ((const Aggref *) expr)->aggcollid;
802 break;
803 case T_GroupingFunc:
804 coll = InvalidOid;
805 break;
806 case T_GroupId:
807 coll = InvalidOid;
808 break;
809 case T_GroupingSetId:
810 coll = InvalidOid;
811 break;
812 case T_WindowFunc:
813 coll = ((const WindowFunc *) expr)->wincollid;
814 break;
815 case T_SubscriptingRef:
816 coll = ((const SubscriptingRef *) expr)->refcollid;
817 break;
818 case T_FuncExpr:
819 coll = ((const FuncExpr *) expr)->funccollid;
820 break;
821 case T_NamedArgExpr:
822 coll = exprCollation((Node *) ((const NamedArgExpr *) expr)->arg);
823 break;
824 case T_OpExpr:
825 coll = ((const OpExpr *) expr)->opcollid;
826 break;
827 case T_DistinctExpr:
828 coll = ((const DistinctExpr *) expr)->opcollid;
829 break;
830 case T_NullIfExpr:
831 coll = ((const NullIfExpr *) expr)->opcollid;
832 break;
833 case T_ScalarArrayOpExpr:
834 /* ScalarArrayOpExpr's result is boolean ... */
835 coll = InvalidOid; /* ... so it has no collation */
836 break;
837 case T_BoolExpr:
838 /* BoolExpr's result is boolean ... */

Callers 15

mcv_match_expressionFunction · 0.85
examine_attributeFunction · 0.85
examine_expressionFunction · 0.85
pg_get_indexdef_workerFunction · 0.85
pg_get_partkeydef_workerFunction · 0.85
scalararrayselFunction · 0.85
ordered_set_startupFunction · 0.85
get_expr_result_typeFunction · 0.85
examine_attributeFunction · 0.85
ComputeIndexAttrsFunction · 0.85

Calls

no outgoing calls

Tested by 1