diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-04-07 02:34:57 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-04-07 02:34:57 -0400 |
commit | d8d429890d6aa0246e28faa187a55cb0c65efd6e (patch) | |
tree | c49d7dd60e614b555cc5d468128c9f787e388583 /src/backend/parser/parse_utilcmd.c | |
parent | 2594cf0e8c04406ffff19b1651c5a406d376657c (diff) | |
download | postgresql-d8d429890d6aa0246e28faa187a55cb0c65efd6e.tar.gz postgresql-d8d429890d6aa0246e28faa187a55cb0c65efd6e.zip |
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.
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r-- | src/backend/parser/parse_utilcmd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index fe8d0c4fac1..b65f5f991cb 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -1829,9 +1829,13 @@ transformIndexStmt(IndexStmt *stmt, const char *queryString) /* take care of the where clause */ if (stmt->whereClause) + { stmt->whereClause = transformWhereClause(pstate, stmt->whereClause, "WHERE"); + /* we have to fix its collations too */ + assign_expr_collations(pstate, stmt->whereClause); + } /* take care of any index expressions */ foreach(l, stmt->indexParams) @@ -1959,6 +1963,8 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString, *whereClause = transformWhereClause(pstate, (Node *) copyObject(stmt->whereClause), "WHERE"); + /* we have to fix its collations too */ + assign_expr_collations(pstate, *whereClause); if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */ ereport(ERROR, |