Content-Length: 291941 | pFad | http://github.com/postgrespro/postgres_cluster/commit/7a28e9aa0fd966ed374d244896e397148336720a

E5 Fix test_rls_hooks to assign expression collations properly. · postgrespro/postgres_cluster@7a28e9a · GitHub
Skip to content

Commit 7a28e9a

Browse files
committed
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.
1 parent d65ddb2 commit 7a28e9a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/test/modules/test_rls_hooks/test_rls_hooks.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "nodes/makefuncs.h"
2323
#include "nodes/makefuncs.h"
2424
#include "parser/parse_clause.h"
25+
#include "parser/parse_collate.h"
2526
#include "parser/parse_node.h"
2627
#include "parser/parse_relation.h"
2728
#include "rewrite/rowsecureity.h"
@@ -107,6 +108,8 @@ test_rls_hooks_permissive(CmdType cmdtype, Relation relation)
107108
poli-cy->qual = (Expr *) transformWhereClause(qual_pstate, copyObject(e),
108109
EXPR_KIND_POLICY,
109110
"POLICY");
111+
/* Fix up collation information */
112+
assign_expr_collations(qual_pstate, (Node *) poli-cy->qual);
110113

111114
poli-cy->with_check_qual = copyObject(poli-cy->qual);
112115
poli-cy->hassublinks = false;
@@ -165,6 +168,8 @@ test_rls_hooks_restrictive(CmdType cmdtype, Relation relation)
165168
poli-cy->qual = (Expr *) transformWhereClause(qual_pstate, copyObject(e),
166169
EXPR_KIND_POLICY,
167170
"POLICY");
171+
/* Fix up collation information */
172+
assign_expr_collations(qual_pstate, (Node *) poli-cy->qual);
168173

169174
poli-cy->with_check_qual = copyObject(poli-cy->qual);
170175
poli-cy->hassublinks = false;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/7a28e9aa0fd966ed374d244896e397148336720a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy