From d2267b61adef7811ab190dc2fa8c0399646434fe Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 11 Dec 2018 11:48:00 -0500 Subject: [PATCH] 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. --- src/test/modules/test_rls_hooks/test_rls_hooks.c | 5 +++++ 1 file changed, 5 insertions(+) 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 7b4fa7ef4a..7eaceb22bc 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 #include #include +#include #include #include #include @@ -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; -- 2.40.0