aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-12-11 11:48:00 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2018-12-11 11:48:00 -0500
commit7a28e9aa0fd966ed374d244896e397148336720a (patch)
treef8e15cd4cb3bde11cbf248e226ce8a2be481a18d
parentd65ddb2b5674cd6cf444c4825270a12b968055ac (diff)
downloadpostgresql-7a28e9aa0fd966ed374d244896e397148336720a.tar.gz
postgresql-7a28e9aa0fd966ed374d244896e397148336720a.zip
Fix test_rls_hooks to assign expression collations properly.
This module overlooked this necessary fixup step on the results of transformWhereClause(). It accidentally worked anyway, because the constructed expression involved type "name" which is not collatable, but it fell over while I was experimenting with changing "name" to be collatable. Back-patch, not because there's any live bug here in back branches, but because somebody might use this code as a model for some real application and then not understand why it doesn't work.
-rw-r--r--src/test/modules/test_rls_hooks/test_rls_hooks.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/modules/test_rls_hooks/test_rls_hooks.c b/src/test/modules/test_rls_hooks/test_rls_hooks.c
index d492697e88d..f582bb0dba5 100644
--- a/src/test/modules/test_rls_hooks/test_rls_hooks.c
+++ b/src/test/modules/test_rls_hooks/test_rls_hooks.c
@@ -22,6 +22,7 @@
#include "nodes/makefuncs.h"
#include "nodes/makefuncs.h"
#include "parser/parse_clause.h"
+#include "parser/parse_collate.h"
#include "parser/parse_node.h"
#include "parser/parse_relation.h"
#include "rewrite/rowsecurity.h"
@@ -107,6 +108,8 @@ test_rls_hooks_permissive(CmdType cmdtype, Relation relation)
policy->qual = (Expr *) transformWhereClause(qual_pstate, copyObject(e),
EXPR_KIND_POLICY,
"POLICY");
+ /* Fix up collation information */
+ assign_expr_collations(qual_pstate, (Node *) policy->qual);
policy->with_check_qual = copyObject(policy->qual);
policy->hassublinks = false;
@@ -165,6 +168,8 @@ test_rls_hooks_restrictive(CmdType cmdtype, Relation relation)
policy->qual = (Expr *) transformWhereClause(qual_pstate, copyObject(e),
EXPR_KIND_POLICY,
"POLICY");
+ /* Fix up collation information */
+ assign_expr_collations(qual_pstate, (Node *) policy->qual);
policy->with_check_qual = copyObject(policy->qual);
policy->hassublinks = false;