From d8d429890d6aa0246e28faa187a55cb0c65efd6e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 7 Apr 2011 02:34:57 -0400 Subject: Fix collations when we call transformWhereClause from outside the parser. Previous patches took care of assorted places that call transformExpr from outside the main parser, but I overlooked the fact that some places use transformWhereClause as a shortcut for transformExpr + coerce_to_boolean. In particular this broke collation-sensitive index WHERE clauses, as per report from Thom Brown. Trigger WHEN and rule WHERE clauses too. I'm not forcing initdb for this fix, but any affected indexes, triggers, or rules will need to be dropped and recreated. --- src/backend/commands/trigger.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/backend/commands/trigger.c') diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 0af8a11b0a7..329d4d95f15 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -36,6 +36,7 @@ #include "optimizer/clauses.h" #include "optimizer/var.h" #include "parser/parse_clause.h" +#include "parser/parse_collate.h" #include "parser/parse_func.h" #include "parser/parse_relation.h" #include "parser/parsetree.h" @@ -282,6 +283,8 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, whenClause = transformWhereClause(pstate, copyObject(stmt->whenClause), "WHEN"); + /* we have to fix its collations too */ + assign_expr_collations(pstate, whenClause); /* * No subplans or aggregates, please -- cgit v1.2.3