codekingpro/portable-devtools
115k
1/* -------------------------------------------------------------------------2 *3 * rowsecurity.h4 *5 * prototypes for rewrite/rowsecurity.c and the structures for managing6 * the row security policies for relations in relcache.7 *8 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group9 * Portions Copyright (c) 1994, Regents of the University of California10 *11 * -------------------------------------------------------------------------12 */13#ifndef ROWSECURITY_H14#define ROWSECURITY_H15 16#include "nodes/parsenodes.h"17#include "utils/array.h"18#include "utils/relcache.h"19 20typedef struct RowSecurityPolicy21{22 char *policy_name; /* Name of the policy */23 char polcmd; /* Type of command policy is for */24 ArrayType *roles; /* Array of roles policy is for */25 bool permissive; /* restrictive or permissive policy */26 Expr *qual; /* Expression to filter rows */27 Expr *with_check_qual; /* Expression to limit rows allowed */28 bool hassublinks; /* If either expression has sublinks */29} RowSecurityPolicy;30 31typedef struct RowSecurityDesc32{33 MemoryContext rscxt; /* row security memory context */34 List *policies; /* list of row security policies */35} RowSecurityDesc;36 37typedef List *(*row_security_policy_hook_type) (CmdType cmdtype,38 Relation relation);39 40extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive;41 42extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_restrictive;43 44extern void get_row_security_policies(Query *root,45 RangeTblEntry *rte, int rt_index,46 List **securityQuals, List **withCheckOptions,47 bool *hasRowSecurity, bool *hasSubLinks);48 49#endif /* ROWSECURITY_H */50 