pgsql: Allow LEAKPROOF functions for better performance of security vie

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow LEAKPROOF functions for better performance of security vie
Date: 2012-02-14 03:22:04
Message-ID: E1Rx8xw-0004Uz-Ur@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/cd30728fb2ed7c367d545fc14ab850b5fa2a4850

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 12 +
doc/src/sgml/ref/alter_function.sgml | 13 +-
doc/src/sgml/ref/create_function.sgml | 19 +-
doc/src/sgml/rules.sgml | 14 +
src/backend/catalog/pg_aggregate.c | 1 +
src/backend/catalog/pg_proc.c | 2 +
src/backend/commands/functioncmds.c | 40 +-
src/backend/commands/proclang.c | 3 +
src/backend/commands/typecmds.c | 1 +
src/backend/optimizer/path/allpaths.c | 11 +-
src/backend/optimizer/util/clauses.c | 140 +
src/backend/parser/gram.y | 7 +-
src/backend/utils/cache/lsyscache.c | 19 +
src/bin/pg_dump/pg_dump.c | 33 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_class.h | 2 +-
src/include/catalog/pg_proc.h | 4833 ++++++++++++-----------
src/include/catalog/pg_proc_fn.h | 1 +
src/include/optimizer/clauses.h | 2 +
src/include/parser/kwlist.h | 1 +
src/include/utils/lsyscache.h | 1 +
src/test/regress/expected/create_function_3.out | 463 +++
src/test/regress/expected/select_views.out | 20 +-
src/test/regress/expected/select_views_1.out | 20 +-
src/test/regress/parallel_schedule | 1 +
src/test/regress/serial_schedule | 1 +
src/test/regress/sql/create_function_3.sql | 145 +
src/test/regress/sql/select_views.sql | 3 +-
28 files changed, 3356 insertions(+), 2454 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2012-02-14 03:49:55 pgsql: Fix new create_function_3 regression tests not to rely on tuple
Previous Message Bruce Momjian 2012-02-14 02:48:53 pgsql: Improve labeling of pg_test_fsync open_sync test output.