After looking more closely at these modules, I'm kind of inclined *not* to put the trusted marker on intagg. That module is just a backwards-compatibility wrapper around functionality that exists in the core code nowadays. So I think what we ought to be doing with it is deprecating and eventually removing it, not encouraging people to keep using it.
Given that and the other discussion in this thread, I think the initial list of modules to trust is: btree_gin btree_gist citext cube dict_int earthdistance fuzzystrmatch hstore hstore_plperl intarray isn jsonb_plperl lo ltree pg_trgm pgcrypto seg tablefunc tcn tsm_system_rows tsm_system_time unaccent uuid-ossp So attached is a patch to do that. The code changes are trivial; just add "trusted = true" to each control file. We don't need to bump the module version numbers, since this doesn't change the contents of any extension, just who can install it. I do not think any regression test changes are needed either. (Note that commit 50fc694e4 already added a test that trusted extensions behave as expected, see src/pl/plperl/sql/plperl_setup.sql.) So it seems like the only thing that needs much discussion is the documentation changes. I adjusted contrib.sgml's discussion of how to install these modules in general, and then labeled the individual modules if they are trusted. regards, tom lane
diff --git a/contrib/btree_gin/btree_gin.control b/contrib/btree_gin/btree_gin.control index d576da7..67d0c99 100644 --- a/contrib/btree_gin/btree_gin.control +++ b/contrib/btree_gin/btree_gin.control @@ -3,3 +3,4 @@ comment = 'support for indexing common datatypes in GIN' default_version = '1.3' module_pathname = '$libdir/btree_gin' relocatable = true +trusted = true diff --git a/contrib/btree_gist/btree_gist.control b/contrib/btree_gist/btree_gist.control index 81c8509..cd2d7eb 100644 --- a/contrib/btree_gist/btree_gist.control +++ b/contrib/btree_gist/btree_gist.control @@ -3,3 +3,4 @@ comment = 'support for indexing common datatypes in GiST' default_version = '1.5' module_pathname = '$libdir/btree_gist' relocatable = true +trusted = true diff --git a/contrib/citext/citext.control b/contrib/citext/citext.control index a872a3f..ccf4454 100644 --- a/contrib/citext/citext.control +++ b/contrib/citext/citext.control @@ -3,3 +3,4 @@ comment = 'data type for case-insensitive character strings' default_version = '1.6' module_pathname = '$libdir/citext' relocatable = true +trusted = true diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control index f39a838..3e238fc 100644 --- a/contrib/cube/cube.control +++ b/contrib/cube/cube.control @@ -3,3 +3,4 @@ comment = 'data type for multidimensional cubes' default_version = '1.4' module_pathname = '$libdir/cube' relocatable = true +trusted = true diff --git a/contrib/dict_int/dict_int.control b/contrib/dict_int/dict_int.control index 6e2d2b3..ec04cce 100644 --- a/contrib/dict_int/dict_int.control +++ b/contrib/dict_int/dict_int.control @@ -3,3 +3,4 @@ comment = 'text search dictionary template for integers' default_version = '1.0' module_pathname = '$libdir/dict_int' relocatable = true +trusted = true diff --git a/contrib/earthdistance/earthdistance.control b/contrib/earthdistance/earthdistance.control index 5816d22..3df666d 100644 --- a/contrib/earthdistance/earthdistance.control +++ b/contrib/earthdistance/earthdistance.control @@ -3,4 +3,5 @@ comment = 'calculate great-circle distances on the surface of the Earth' default_version = '1.1' module_pathname = '$libdir/earthdistance' relocatable = true +trusted = true requires = 'cube' diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.control b/contrib/fuzzystrmatch/fuzzystrmatch.control index 6b2832a..3cd6660 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.control +++ b/contrib/fuzzystrmatch/fuzzystrmatch.control @@ -3,3 +3,4 @@ comment = 'determine similarities and distance between strings' default_version = '1.1' module_pathname = '$libdir/fuzzystrmatch' relocatable = true +trusted = true diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control index 93688cd..e0fbb8b 100644 --- a/contrib/hstore/hstore.control +++ b/contrib/hstore/hstore.control @@ -3,3 +3,4 @@ comment = 'data type for storing sets of (key, value) pairs' default_version = '1.6' module_pathname = '$libdir/hstore' relocatable = true +trusted = true diff --git a/contrib/hstore_plperl/hstore_plperl.control b/contrib/hstore_plperl/hstore_plperl.control index 16277f6..4b9fd13 100644 --- a/contrib/hstore_plperl/hstore_plperl.control +++ b/contrib/hstore_plperl/hstore_plperl.control @@ -3,4 +3,5 @@ comment = 'transform between hstore and plperl' default_version = '1.0' module_pathname = '$libdir/hstore_plperl' relocatable = true +trusted = true requires = 'hstore,plperl' diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control index 7e50cc3..bf28804 100644 --- a/contrib/intarray/intarray.control +++ b/contrib/intarray/intarray.control @@ -3,3 +3,4 @@ comment = 'functions, operators, and index support for 1-D arrays of integers' default_version = '1.2' module_pathname = '$libdir/_int' relocatable = true +trusted = true diff --git a/contrib/isn/isn.control b/contrib/isn/isn.control index 765dce0..1cb5e2b 100644 --- a/contrib/isn/isn.control +++ b/contrib/isn/isn.control @@ -3,3 +3,4 @@ comment = 'data types for international product numbering standards' default_version = '1.2' module_pathname = '$libdir/isn' relocatable = true +trusted = true diff --git a/contrib/jsonb_plperl/jsonb_plperl.control b/contrib/jsonb_plperl/jsonb_plperl.control index 26c86a7..4acee93 100644 --- a/contrib/jsonb_plperl/jsonb_plperl.control +++ b/contrib/jsonb_plperl/jsonb_plperl.control @@ -3,4 +3,5 @@ comment = 'transform between jsonb and plperl' default_version = '1.0' module_pathname = '$libdir/jsonb_plperl' relocatable = true +trusted = true requires = 'plperl' diff --git a/contrib/lo/lo.control b/contrib/lo/lo.control index 820326c..f73f8b5 100644 --- a/contrib/lo/lo.control +++ b/contrib/lo/lo.control @@ -3,3 +3,4 @@ comment = 'Large Object maintenance' default_version = '1.1' module_pathname = '$libdir/lo' relocatable = true +trusted = true diff --git a/contrib/ltree/ltree.control b/contrib/ltree/ltree.control index 03c3fb1..3118df6 100644 --- a/contrib/ltree/ltree.control +++ b/contrib/ltree/ltree.control @@ -3,3 +3,4 @@ comment = 'data type for hierarchical tree-like structures' default_version = '1.1' module_pathname = '$libdir/ltree' relocatable = true +trusted = true diff --git a/contrib/pg_trgm/pg_trgm.control b/contrib/pg_trgm/pg_trgm.control index 3e325dd..831ba23 100644 --- a/contrib/pg_trgm/pg_trgm.control +++ b/contrib/pg_trgm/pg_trgm.control @@ -3,3 +3,4 @@ comment = 'text similarity measurement and index searching based on trigrams' default_version = '1.4' module_pathname = '$libdir/pg_trgm' relocatable = true +trusted = true diff --git a/contrib/pgcrypto/pgcrypto.control b/contrib/pgcrypto/pgcrypto.control index 5839832..d2151d3 100644 --- a/contrib/pgcrypto/pgcrypto.control +++ b/contrib/pgcrypto/pgcrypto.control @@ -3,3 +3,4 @@ comment = 'cryptographic functions' default_version = '1.3' module_pathname = '$libdir/pgcrypto' relocatable = true +trusted = true diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control index d697cd6..9ac3080 100644 --- a/contrib/seg/seg.control +++ b/contrib/seg/seg.control @@ -3,3 +3,4 @@ comment = 'data type for representing line segments or floating-point intervals' default_version = '1.3' module_pathname = '$libdir/seg' relocatable = true +trusted = true diff --git a/contrib/tablefunc/tablefunc.control b/contrib/tablefunc/tablefunc.control index 248b0a7..7b25d16 100644 --- a/contrib/tablefunc/tablefunc.control +++ b/contrib/tablefunc/tablefunc.control @@ -3,3 +3,4 @@ comment = 'functions that manipulate whole tables, including crosstab' default_version = '1.0' module_pathname = '$libdir/tablefunc' relocatable = true +trusted = true diff --git a/contrib/tcn/tcn.control b/contrib/tcn/tcn.control index 8abfd19..6972e11 100644 --- a/contrib/tcn/tcn.control +++ b/contrib/tcn/tcn.control @@ -3,3 +3,4 @@ comment = 'Triggered change notifications' default_version = '1.0' module_pathname = '$libdir/tcn' relocatable = true +trusted = true diff --git a/contrib/tsm_system_rows/tsm_system_rows.control b/contrib/tsm_system_rows/tsm_system_rows.control index 4bd0232..b495fb1 100644 --- a/contrib/tsm_system_rows/tsm_system_rows.control +++ b/contrib/tsm_system_rows/tsm_system_rows.control @@ -3,3 +3,4 @@ comment = 'TABLESAMPLE method which accepts number of rows as a limit' default_version = '1.0' module_pathname = '$libdir/tsm_system_rows' relocatable = true +trusted = true diff --git a/contrib/tsm_system_time/tsm_system_time.control b/contrib/tsm_system_time/tsm_system_time.control index c247987..b1b9789 100644 --- a/contrib/tsm_system_time/tsm_system_time.control +++ b/contrib/tsm_system_time/tsm_system_time.control @@ -3,3 +3,4 @@ comment = 'TABLESAMPLE method which accepts time in milliseconds as a limit' default_version = '1.0' module_pathname = '$libdir/tsm_system_time' relocatable = true +trusted = true diff --git a/contrib/unaccent/unaccent.control b/contrib/unaccent/unaccent.control index a77a65f..649cf68 100644 --- a/contrib/unaccent/unaccent.control +++ b/contrib/unaccent/unaccent.control @@ -3,3 +3,4 @@ comment = 'text search dictionary that removes accents' default_version = '1.1' module_pathname = '$libdir/unaccent' relocatable = true +trusted = true diff --git a/contrib/uuid-ossp/uuid-ossp.control b/contrib/uuid-ossp/uuid-ossp.control index 657476c..142a99e 100644 --- a/contrib/uuid-ossp/uuid-ossp.control +++ b/contrib/uuid-ossp/uuid-ossp.control @@ -3,3 +3,4 @@ comment = 'generate universally unique identifiers (UUIDs)' default_version = '1.1' module_pathname = '$libdir/uuid-ossp' relocatable = true +trusted = true diff --git a/doc/src/sgml/btree-gin.sgml b/doc/src/sgml/btree-gin.sgml index 314e001..5bc5a05 100644 --- a/doc/src/sgml/btree-gin.sgml +++ b/doc/src/sgml/btree-gin.sgml @@ -32,6 +32,12 @@ two separate indexes that would have to be combined via bitmap ANDing. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Example Usage</title> diff --git a/doc/src/sgml/btree-gist.sgml b/doc/src/sgml/btree-gist.sgml index 774442f..3b61d27 100644 --- a/doc/src/sgml/btree-gist.sgml +++ b/doc/src/sgml/btree-gist.sgml @@ -52,6 +52,12 @@ <type>oid</type>, and <type>money</type>. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Example Usage</title> diff --git a/doc/src/sgml/citext.sgml b/doc/src/sgml/citext.sgml index 85aa339..667824f 100644 --- a/doc/src/sgml/citext.sgml +++ b/doc/src/sgml/citext.sgml @@ -24,6 +24,12 @@ </para> </tip> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Rationale</title> diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml index b626a34..08bb110 100644 --- a/doc/src/sgml/contrib.sgml +++ b/doc/src/sgml/contrib.sgml @@ -54,7 +54,7 @@ Many modules supply new user-defined functions, operators, or types. To make use of one of these modules, after you have installed the code you need to register the new SQL objects in the database system. - In <productname>PostgreSQL</productname> 9.1 and later, this is done by executing + This is done by executing a <xref linkend="sql-createextension"/> command. In a fresh database, you can simply do @@ -62,15 +62,24 @@ CREATE EXTENSION <replaceable>module_name</replaceable>; </programlisting> - This command must be run by a database superuser. This registers the - new SQL objects in the current database only, so you need to run this - command in each database that you want + This command registers the new SQL objects in the current database only, + so you need to run it in each database that you want the module's facilities to be available in. Alternatively, run it in database <literal>template1</literal> so that the extension will be copied into subsequently-created databases by default. </para> <para> + For all these modules, <command>CREATE EXTENSION</command> must be run + by a database superuser, unless the module is + considered <quote>trusted</quote>, in which case it can be run by any + user who has <literal>CREATE</literal> privilege on the current + database. Modules that are trusted are identified as such in the + sections that follow. Generally, trusted modules are ones that cannot + provide access to outside-the-database functionality. + </para> + + <para> Many modules allow you to install their objects in a schema of your choice. To do that, add <literal>SCHEMA <replaceable>schema_name</replaceable></literal> to the <command>CREATE EXTENSION</command> diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml index c6e5862..71772d7 100644 --- a/doc/src/sgml/cube.sgml +++ b/doc/src/sgml/cube.sgml @@ -12,6 +12,12 @@ representing multidimensional cubes. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Syntax</title> diff --git a/doc/src/sgml/dict-int.sgml b/doc/src/sgml/dict-int.sgml index c15cbd0..b556f1b 100644 --- a/doc/src/sgml/dict-int.sgml +++ b/doc/src/sgml/dict-int.sgml @@ -15,6 +15,12 @@ unique words, which greatly affects the performance of searching. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Configuration</title> diff --git a/doc/src/sgml/earthdistance.sgml b/doc/src/sgml/earthdistance.sgml index 670fc99..7ca2c40 100644 --- a/doc/src/sgml/earthdistance.sgml +++ b/doc/src/sgml/earthdistance.sgml @@ -23,6 +23,12 @@ project.) </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Cube-Based Earth Distances</title> diff --git a/doc/src/sgml/fuzzystrmatch.sgml b/doc/src/sgml/fuzzystrmatch.sgml index 373ac48..382e54b 100644 --- a/doc/src/sgml/fuzzystrmatch.sgml +++ b/doc/src/sgml/fuzzystrmatch.sgml @@ -20,6 +20,12 @@ </para> </caution> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Soundex</title> diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml index 94ccd12..64c2477 100644 --- a/doc/src/sgml/hstore.sgml +++ b/doc/src/sgml/hstore.sgml @@ -15,6 +15,12 @@ simply text strings. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title><type>hstore</type> External Representation</title> @@ -633,6 +639,11 @@ ALTER TABLE tablename ALTER hstorecol TYPE hstore USING hstorecol || ''; convention). If you use them, <type>hstore</type> values are mapped to Python dictionaries. </para> + + <para> + Of these additional extensions, <literal>hstore_plperl</literal> is + considered trusted; the rest are not. + </para> </sect2> <sect2> diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml index b633cf3..025cbca 100644 --- a/doc/src/sgml/intarray.sgml +++ b/doc/src/sgml/intarray.sgml @@ -24,6 +24,12 @@ treated as though it were a linear array in storage order. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title><filename>intarray</filename> Functions and Operators</title> diff --git a/doc/src/sgml/isn.sgml b/doc/src/sgml/isn.sgml index 2117454..6c61f14 100644 --- a/doc/src/sgml/isn.sgml +++ b/doc/src/sgml/isn.sgml @@ -21,6 +21,12 @@ dropped from a future version of this module. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Data Types</title> diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml index 6ff8751..1b6aaf0 100644 --- a/doc/src/sgml/json.sgml +++ b/doc/src/sgml/json.sgml @@ -622,6 +622,13 @@ SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @> '{"tags": ["qu use them, <type>jsonb</type> values are mapped to Python dictionaries, lists, and scalars, as appropriate. </para> + + <para> + Of these extensions, <literal>jsonb_plperl</literal> is + considered <quote>trusted</quote>, that is, it can be installed by + non-superusers who have <literal>CREATE</literal> privilege on the + current database. The rest require superuser privilege to install. + </para> </sect2> <sect2 id="datatype-jsonpath"> diff --git a/doc/src/sgml/lo.sgml b/doc/src/sgml/lo.sgml index cce3793..0a4f2e4 100644 --- a/doc/src/sgml/lo.sgml +++ b/doc/src/sgml/lo.sgml @@ -13,6 +13,12 @@ and a trigger <function>lo_manage</function>. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Rationale</title> diff --git a/doc/src/sgml/ltree.sgml b/doc/src/sgml/ltree.sgml index 3ddd335..b4e07f6 100644 --- a/doc/src/sgml/ltree.sgml +++ b/doc/src/sgml/ltree.sgml @@ -13,6 +13,12 @@ Extensive facilities for searching through label trees are provided. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Definitions</title> diff --git a/doc/src/sgml/pgcrypto.sgml b/doc/src/sgml/pgcrypto.sgml index 0acd11e..cc916ff 100644 --- a/doc/src/sgml/pgcrypto.sgml +++ b/doc/src/sgml/pgcrypto.sgml @@ -17,6 +17,12 @@ <productname>PostgreSQL</productname>. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>General Hashing Functions</title> diff --git a/doc/src/sgml/pgtrgm.sgml b/doc/src/sgml/pgtrgm.sgml index 3e6fd73..049f496 100644 --- a/doc/src/sgml/pgtrgm.sgml +++ b/doc/src/sgml/pgtrgm.sgml @@ -15,6 +15,12 @@ strings. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Trigram (or Trigraph) Concepts</title> diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml index d07329f..2492de9 100644 --- a/doc/src/sgml/seg.sgml +++ b/doc/src/sgml/seg.sgml @@ -14,6 +14,12 @@ making it especially useful for representing laboratory measurements. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Rationale</title> diff --git a/doc/src/sgml/tablefunc.sgml b/doc/src/sgml/tablefunc.sgml index 007e9c6..ad435d6 100644 --- a/doc/src/sgml/tablefunc.sgml +++ b/doc/src/sgml/tablefunc.sgml @@ -14,6 +14,12 @@ multiple rows. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Functions Provided</title> diff --git a/doc/src/sgml/tcn.sgml b/doc/src/sgml/tcn.sgml index aa2fe4f..82afe9a 100644 --- a/doc/src/sgml/tcn.sgml +++ b/doc/src/sgml/tcn.sgml @@ -18,6 +18,12 @@ </para> <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + + <para> Only one parameter may be supplied to the function in a <literal>CREATE TRIGGER</literal> statement, and that is optional. If supplied it will be used for the channel name for the notifications. If omitted diff --git a/doc/src/sgml/tsm-system-rows.sgml b/doc/src/sgml/tsm-system-rows.sgml index 3dcd948..071ff30 100644 --- a/doc/src/sgml/tsm-system-rows.sgml +++ b/doc/src/sgml/tsm-system-rows.sgml @@ -33,6 +33,12 @@ the <literal>REPEATABLE</literal> clause. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Examples</title> diff --git a/doc/src/sgml/tsm-system-time.sgml b/doc/src/sgml/tsm-system-time.sgml index fd8e999..cd07492 100644 --- a/doc/src/sgml/tsm-system-time.sgml +++ b/doc/src/sgml/tsm-system-time.sgml @@ -35,6 +35,12 @@ the <literal>REPEATABLE</literal> clause. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Examples</title> diff --git a/doc/src/sgml/unaccent.sgml b/doc/src/sgml/unaccent.sgml index 547ac54..5cd716a 100644 --- a/doc/src/sgml/unaccent.sgml +++ b/doc/src/sgml/unaccent.sgml @@ -21,6 +21,12 @@ normalizing dictionary for the <filename>thesaurus</filename> dictionary. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title>Configuration</title> diff --git a/doc/src/sgml/uuid-ossp.sgml b/doc/src/sgml/uuid-ossp.sgml index 0fbabbf..54d7813 100644 --- a/doc/src/sgml/uuid-ossp.sgml +++ b/doc/src/sgml/uuid-ossp.sgml @@ -16,6 +16,12 @@ linkend="functions-uuid"/> for built-in ways to generate UUIDs. </para> + <para> + This module is considered <quote>trusted</quote>, that is, it can be + installed by non-superusers who have <literal>CREATE</literal> privilege + on the current database. + </para> + <sect2> <title><literal>uuid-ossp</literal> Functions</title>