mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-10 03:57:35 +08:00
Allow LEAKPROOF functions for better performance of security views.
We don't normally allow quals to be pushed down into a view created with the security_barrier option, but functions without side effects are an exception: they're OK. This allows much better performance in common cases, such as when using an equality operator (that might even be indexable). There is an outstanding issue here with the CREATE FUNCTION / ALTER FUNCTION syntax: there's no way to use ALTER FUNCTION to unset the leakproof flag. But I'm committing this as-is so that it doesn't have to be rebased again; we can fix up the grammar in a future commit. KaiGai Kohei, with some wordsmithing by me.
This commit is contained in:
@ -53,6 +53,6 @@
|
||||
*/
|
||||
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 201202083
|
||||
#define CATALOG_VERSION_NO 201202131
|
||||
|
||||
#endif
|
||||
|
||||
@ -134,7 +134,7 @@ DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 0 f f p r 30 0
|
||||
DESCR("");
|
||||
DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 0 f f p r 21 0 f f f f f 3 _null_ _null_ ));
|
||||
DESCR("");
|
||||
DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 0 f f p r 26 0 t f f f f 3 _null_ _null_ ));
|
||||
DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 0 f f p r 27 0 t f f f f 3 _null_ _null_ ));
|
||||
DESCR("");
|
||||
DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 0 f f p r 27 0 t f f f f 3 _null_ _null_ ));
|
||||
DESCR("");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -28,6 +28,7 @@ extern Oid ProcedureCreate(const char *procedureName,
|
||||
bool isAgg,
|
||||
bool isWindowFunc,
|
||||
bool security_definer,
|
||||
bool isLeakProof,
|
||||
bool isStrict,
|
||||
char volatility,
|
||||
oidvector *parameterTypes,
|
||||
|
||||
@ -61,6 +61,8 @@ extern bool contain_subplans(Node *clause);
|
||||
extern bool contain_mutable_functions(Node *clause);
|
||||
extern bool contain_volatile_functions(Node *clause);
|
||||
extern bool contain_nonstrict_functions(Node *clause);
|
||||
extern bool contain_leaky_functions(Node *clause);
|
||||
|
||||
extern Relids find_nonnullable_rels(Node *clause);
|
||||
extern List *find_nonnullable_vars(Node *clause);
|
||||
extern List *find_forced_null_vars(Node *clause);
|
||||
|
||||
@ -215,6 +215,7 @@ PG_KEYWORD("last", LAST_P, UNRESERVED_KEYWORD)
|
||||
PG_KEYWORD("lc_collate", LC_COLLATE_P, UNRESERVED_KEYWORD)
|
||||
PG_KEYWORD("lc_ctype", LC_CTYPE_P, UNRESERVED_KEYWORD)
|
||||
PG_KEYWORD("leading", LEADING, RESERVED_KEYWORD)
|
||||
PG_KEYWORD("leakproof", LEAKPROOF, UNRESERVED_KEYWORD)
|
||||
PG_KEYWORD("least", LEAST, COL_NAME_KEYWORD)
|
||||
PG_KEYWORD("left", LEFT, TYPE_FUNC_NAME_KEYWORD)
|
||||
PG_KEYWORD("level", LEVEL, UNRESERVED_KEYWORD)
|
||||
|
||||
@ -91,6 +91,7 @@ extern Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs);
|
||||
extern bool get_func_retset(Oid funcid);
|
||||
extern bool func_strict(Oid funcid);
|
||||
extern char func_volatile(Oid funcid);
|
||||
extern bool get_func_leakproof(Oid funcid);
|
||||
extern float4 get_func_cost(Oid funcid);
|
||||
extern float4 get_func_rows(Oid funcid);
|
||||
extern Oid get_relname_relid(const char *relname, Oid relnamespace);
|
||||
|
||||
Reference in New Issue
Block a user