Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd8d4298

Browse files
committed
Fix collations when we call transformWhereClause from outside the parser.
Previous patches took care of assorted places that call transformExpr fromoutside the main parser, but I overlooked the fact that some places usetransformWhereClause as a shortcut for transformExpr + coerce_to_boolean.In particular this broke collation-sensitive index WHERE clauses, as perreport 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.
1 parent2594cf0 commitd8d4298

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

‎src/backend/commands/trigger.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include"optimizer/clauses.h"
3737
#include"optimizer/var.h"
3838
#include"parser/parse_clause.h"
39+
#include"parser/parse_collate.h"
3940
#include"parser/parse_func.h"
4041
#include"parser/parse_relation.h"
4142
#include"parser/parsetree.h"
@@ -282,6 +283,8 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
282283
whenClause=transformWhereClause(pstate,
283284
copyObject(stmt->whenClause),
284285
"WHEN");
286+
/* we have to fix its collations too */
287+
assign_expr_collations(pstate,whenClause);
285288

286289
/*
287290
* No subplans or aggregates, please

‎src/backend/parser/parse_utilcmd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,9 +1829,13 @@ transformIndexStmt(IndexStmt *stmt, const char *queryString)
18291829

18301830
/* take care of the where clause */
18311831
if (stmt->whereClause)
1832+
{
18321833
stmt->whereClause=transformWhereClause(pstate,
18331834
stmt->whereClause,
18341835
"WHERE");
1836+
/* we have to fix its collations too */
1837+
assign_expr_collations(pstate,stmt->whereClause);
1838+
}
18351839

18361840
/* take care of any index expressions */
18371841
foreach(l,stmt->indexParams)
@@ -1959,6 +1963,8 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
19591963
*whereClause=transformWhereClause(pstate,
19601964
(Node*)copyObject(stmt->whereClause),
19611965
"WHERE");
1966+
/* we have to fix its collations too */
1967+
assign_expr_collations(pstate,*whereClause);
19621968

19631969
if (list_length(pstate->p_rtable)!=2)/* naughty, naughty... */
19641970
ereport(ERROR,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp