@@ -802,10 +802,12 @@ exprCollation(const Node *expr)
802802coll = ((const NullIfExpr * )expr )-> opcollid ;
803803break ;
804804case T_ScalarArrayOpExpr :
805- coll = InvalidOid ;/* result is always boolean */
805+ /* ScalarArrayOpExpr's result is boolean ... */
806+ coll = InvalidOid ;/* ... so it has no collation */
806807break ;
807808case T_BoolExpr :
808- coll = InvalidOid ;/* result is always boolean */
809+ /* BoolExpr's result is boolean ... */
810+ coll = InvalidOid ;/* ... so it has no collation */
809811break ;
810812case T_SubLink :
811813{
@@ -827,8 +829,8 @@ exprCollation(const Node *expr)
827829}
828830else
829831{
830- /* otherwise, result is RECORD or BOOLEAN */
831- coll = InvalidOid ;
832+ /* otherwise,SubLink's result is RECORD or BOOLEAN */
833+ coll = InvalidOid ;/* ... so it has no collation */
832834}
833835}
834836break ;
@@ -845,8 +847,8 @@ exprCollation(const Node *expr)
845847}
846848else
847849{
848- /* otherwise, result is RECORD or BOOLEAN */
849- coll = InvalidOid ;
850+ /* otherwise,SubPlan's result is RECORD or BOOLEAN */
851+ coll = InvalidOid ;/* ... so it has no collation */
850852}
851853}
852854break ;
@@ -862,7 +864,8 @@ exprCollation(const Node *expr)
862864coll = ((const FieldSelect * )expr )-> resultcollid ;
863865break ;
864866case T_FieldStore :
865- coll = InvalidOid ;/* result is always composite */
867+ /* FieldStore's result is composite ... */
868+ coll = InvalidOid ;/* ... so it has no collation */
866869break ;
867870case T_RelabelType :
868871coll = ((const RelabelType * )expr )-> resultcollid ;
@@ -874,7 +877,8 @@ exprCollation(const Node *expr)
874877coll = ((const ArrayCoerceExpr * )expr )-> resultcollid ;
875878break ;
876879case T_ConvertRowtypeExpr :
877- coll = InvalidOid ;/* result is always composite */
880+ /* ConvertRowtypeExpr's result is composite ... */
881+ coll = InvalidOid ;/* ... so it has no collation */
878882break ;
879883case T_CollateExpr :
880884coll = ((const CollateExpr * )expr )-> collOid ;
@@ -889,10 +893,12 @@ exprCollation(const Node *expr)
889893coll = ((const ArrayExpr * )expr )-> array_collid ;
890894break ;
891895case T_RowExpr :
892- coll = InvalidOid ;/* result is always composite */
896+ /* RowExpr's result is composite ... */
897+ coll = InvalidOid ;/* ... so it has no collation */
893898break ;
894899case T_RowCompareExpr :
895- coll = InvalidOid ;/* result is always boolean */
900+ /* RowCompareExpr's result is boolean ... */
901+ coll = InvalidOid ;/* ... so it has no collation */
896902break ;
897903case T_CoalesceExpr :
898904coll = ((const CoalesceExpr * )expr )-> coalescecollid ;
@@ -920,10 +926,12 @@ exprCollation(const Node *expr)
920926coll = InvalidOid ;
921927break ;
922928case T_NullTest :
923- coll = InvalidOid ;/* result is always boolean */
929+ /* NullTest's result is boolean ... */
930+ coll = InvalidOid ;/* ... so it has no collation */
924931break ;
925932case T_BooleanTest :
926- coll = InvalidOid ;/* result is always boolean */
933+ /* BooleanTest's result is boolean ... */
934+ coll = InvalidOid ;/* ... so it has no collation */
927935break ;
928936case T_CoerceToDomain :
929937coll = ((const CoerceToDomain * )expr )-> resultcollid ;
@@ -935,10 +943,12 @@ exprCollation(const Node *expr)
935943coll = ((const SetToDefault * )expr )-> collation ;
936944break ;
937945case T_CurrentOfExpr :
938- coll = InvalidOid ;/* result is always boolean */
946+ /* CurrentOfExpr's result is boolean ... */
947+ coll = InvalidOid ;/* ... so it has no collation */
939948break ;
940949case T_NextValueExpr :
941- coll = InvalidOid ;/* result is always an integer type */
950+ /* NextValueExpr's result is an integer type ... */
951+ coll = InvalidOid ;/* ... so it has no collation */
942952break ;
943953case T_InferenceElem :
944954coll = exprCollation ((Node * ) ((const InferenceElem * )expr )-> expr );
@@ -1050,10 +1060,12 @@ exprSetCollation(Node *expr, Oid collation)
10501060((NullIfExpr * )expr )-> opcollid = collation ;
10511061break ;
10521062case T_ScalarArrayOpExpr :
1053- Assert (!OidIsValid (collation ));/* result is always boolean */
1063+ /* ScalarArrayOpExpr's result is boolean ... */
1064+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
10541065break ;
10551066case T_BoolExpr :
1056- Assert (!OidIsValid (collation ));/* result is always boolean */
1067+ /* BoolExpr's result is boolean ... */
1068+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
10571069break ;
10581070case T_SubLink :
10591071#ifdef USE_ASSERT_CHECKING
@@ -1085,7 +1097,8 @@ exprSetCollation(Node *expr, Oid collation)
10851097((FieldSelect * )expr )-> resultcollid = collation ;
10861098break ;
10871099case T_FieldStore :
1088- Assert (!OidIsValid (collation ));/* result is always composite */
1100+ /* FieldStore's result is composite ... */
1101+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
10891102break ;
10901103case T_RelabelType :
10911104((RelabelType * )expr )-> resultcollid = collation ;
@@ -1097,7 +1110,8 @@ exprSetCollation(Node *expr, Oid collation)
10971110((ArrayCoerceExpr * )expr )-> resultcollid = collation ;
10981111break ;
10991112case T_ConvertRowtypeExpr :
1100- Assert (!OidIsValid (collation ));/* result is always composite */
1113+ /* ConvertRowtypeExpr's result is composite ... */
1114+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
11011115break ;
11021116case T_CaseExpr :
11031117((CaseExpr * )expr )-> casecollid = collation ;
@@ -1106,10 +1120,12 @@ exprSetCollation(Node *expr, Oid collation)
11061120((ArrayExpr * )expr )-> array_collid = collation ;
11071121break ;
11081122case T_RowExpr :
1109- Assert (!OidIsValid (collation ));/* result is always composite */
1123+ /* RowExpr's result is composite ... */
1124+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
11101125break ;
11111126case T_RowCompareExpr :
1112- Assert (!OidIsValid (collation ));/* result is always boolean */
1127+ /* RowCompareExpr's result is boolean ... */
1128+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
11131129break ;
11141130case T_CoalesceExpr :
11151131((CoalesceExpr * )expr )-> coalescecollid = collation ;
@@ -1128,10 +1144,12 @@ exprSetCollation(Node *expr, Oid collation)
11281144 (collation == InvalidOid ));
11291145break ;
11301146case T_NullTest :
1131- Assert (!OidIsValid (collation ));/* result is always boolean */
1147+ /* NullTest's result is boolean ... */
1148+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
11321149break ;
11331150case T_BooleanTest :
1134- Assert (!OidIsValid (collation ));/* result is always boolean */
1151+ /* BooleanTest's result is boolean ... */
1152+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
11351153break ;
11361154case T_CoerceToDomain :
11371155((CoerceToDomain * )expr )-> resultcollid = collation ;
@@ -1143,11 +1161,12 @@ exprSetCollation(Node *expr, Oid collation)
11431161((SetToDefault * )expr )-> collation = collation ;
11441162break ;
11451163case T_CurrentOfExpr :
1146- Assert (!OidIsValid (collation ));/* result is always boolean */
1164+ /* CurrentOfExpr's result is boolean ... */
1165+ Assert (!OidIsValid (collation ));/* ... so never set a collation */
11471166break ;
11481167case T_NextValueExpr :
1149- Assert (! OidIsValid ( collation )); /* result isalways an integer
1150- * type */
1168+ /*NextValueExpr's result is an integer type ... */
1169+ Assert (! OidIsValid ( collation )); /* ... so never set a collation */
11511170break ;
11521171default :
11531172elog (ERROR ,"unrecognized node type: %d" , (int )nodeTag (expr ));