pgsql: Allow LEAKPROOF functions for better performance of security vie - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Allow LEAKPROOF functions for better performance of security vie
Date
Msg-id E1Rx8xw-0004Uz-Ur@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Bruce Momjian
Date:
Subject: pgsql: Improve labeling of pg_test_fsync open_sync test output.
Next
From: Robert Haas
Date:
Subject: pgsql: Fix new create_function_3 regression tests not to rely on tuple