Allow LEAKPROOF functions for better performance of security views.
authorRobert Haas <rhaas@postgresql.org>
Tue, 14 Feb 2012 03:20:27 +0000 (22:20 -0500)
committerRobert Haas <rhaas@postgresql.org>
Tue, 14 Feb 2012 03:21:14 +0000 (22:21 -0500)
commitcd30728fb2ed7c367d545fc14ab850b5fa2a4850
treec5d487f3abf9e5c66734db8ecb100f4442763822
parent2bbd88f8f841b01efb073972b60d4dc1ff1f6fd0
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.
28 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/ref/alter_function.sgml
doc/src/sgml/ref/create_function.sgml
doc/src/sgml/rules.sgml
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_proc.c
src/backend/commands/functioncmds.c
src/backend/commands/proclang.c
src/backend/commands/typecmds.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/util/clauses.c
src/backend/parser/gram.y
src/backend/utils/cache/lsyscache.c
src/bin/pg_dump/pg_dump.c
src/include/catalog/catversion.h
src/include/catalog/pg_class.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_proc_fn.h
src/include/optimizer/clauses.h
src/include/parser/kwlist.h
src/include/utils/lsyscache.h
src/test/regress/expected/create_function_3.out [new file with mode: 0644]
src/test/regress/expected/select_views.out
src/test/regress/expected/select_views_1.out
src/test/regress/parallel_schedule
src/test/regress/serial_schedule
src/test/regress/sql/create_function_3.sql [new file with mode: 0644]
src/test/regress/sql/select_views.sql