mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-25 21:47:20 +02:00
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.
This commit is contained in:
parent
9fbe7d9740
commit
4e33da5f0a
@ -22,6 +22,7 @@
|
|||||||
#include "nodes/makefuncs.h"
|
#include "nodes/makefuncs.h"
|
||||||
#include "nodes/makefuncs.h"
|
#include "nodes/makefuncs.h"
|
||||||
#include "parser/parse_clause.h"
|
#include "parser/parse_clause.h"
|
||||||
|
#include "parser/parse_collate.h"
|
||||||
#include "parser/parse_node.h"
|
#include "parser/parse_node.h"
|
||||||
#include "parser/parse_relation.h"
|
#include "parser/parse_relation.h"
|
||||||
#include "rewrite/rowsecurity.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),
|
policy->qual = (Expr *) transformWhereClause(qual_pstate, copyObject(e),
|
||||||
EXPR_KIND_POLICY,
|
EXPR_KIND_POLICY,
|
||||||
"POLICY");
|
"POLICY");
|
||||||
|
/* Fix up collation information */
|
||||||
|
assign_expr_collations(qual_pstate, (Node *) policy->qual);
|
||||||
|
|
||||||
policy->with_check_qual = copyObject(policy->qual);
|
policy->with_check_qual = copyObject(policy->qual);
|
||||||
policy->hassublinks = false;
|
policy->hassublinks = false;
|
||||||
@ -165,6 +168,8 @@ test_rls_hooks_restrictive(CmdType cmdtype, Relation relation)
|
|||||||
policy->qual = (Expr *) transformWhereClause(qual_pstate, copyObject(e),
|
policy->qual = (Expr *) transformWhereClause(qual_pstate, copyObject(e),
|
||||||
EXPR_KIND_POLICY,
|
EXPR_KIND_POLICY,
|
||||||
"POLICY");
|
"POLICY");
|
||||||
|
/* Fix up collation information */
|
||||||
|
assign_expr_collations(qual_pstate, (Node *) policy->qual);
|
||||||
|
|
||||||
policy->with_check_qual = copyObject(policy->qual);
|
policy->with_check_qual = copyObject(policy->qual);
|
||||||
policy->hassublinks = false;
|
policy->hassublinks = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user