From 6767cebc6fb2932752ebb69127817be7b7a10414 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 23 Sep 2003 22:48:53 +0000 Subject: pg_dump/pg_restore now always use SET SESSION AUTHORIZATION, not \connect, to control object ownership. The use-set-session-authorization and no-reconnect switches are obsolete (still accepted on the command line, but they don't do anything). This is a precursor to fixing handling of CREATE SCHEMA, which will be a separate commit. --- doc/src/sgml/ref/pg_dump.sgml | 84 ++++++++++------------------------------ doc/src/sgml/ref/pg_restore.sgml | 49 +++++++++-------------- 2 files changed, 38 insertions(+), 95 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 80dd35041f9..73ab39cef10 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1,5 +1,5 @@ @@ -318,16 +318,16 @@ PostgreSQL documentation - Do not output commands to set the - object ownership to match the original database. Typically, - pg_dump issues - (psql-specific) \connect - statements to set ownership of schema elements. See also - under and . Note that - does not prevent all reconnections to the - database, only the ones that are exclusively used for - ownership adjustments. + Do not output commands to set + ownership of objects to match the original database. + By default, pg_dump issues + SET SESSION AUTHORIZATION + statements to set ownership of created schema elements. + These statements + will fail when the script is run unless it is started by a superuser + (or the same user that owns all of the objects in the script). + To make a script that can be restored by any user, but will give + that user ownership of all the objects, specify @@ -343,27 +343,8 @@ PostgreSQL documentation - Prohibit pg_dump - from outputting a script that would require reconnections to - the database while being restored. An average restoration - script usually has to reconnect several times as different - users to set the original ownerships of the objects. This - option is a rather blunt instrument because it makes - pg_dump lose this ownership information, - unless you use the option. - - - - One possible reason why reconnections during restore might not - be desired is if the access to the database requires manual - interaction (e.g., passwords). - - - - This option is only meaningful for the plain-text format. For - the other formats, you may specify the option when you - call pg_restore. + This option is obsolete but still accepted for backwards + compatibility. @@ -385,8 +366,7 @@ PostgreSQL documentation Specify the superuser user name to use when disabling triggers. This is only relevant if @@ -444,32 +424,10 @@ PostgreSQL documentation - Normally, if a (plain-text mode) script generated by - pg_dump must alter the current database - user (e.g., to set correct object ownerships), it uses the - psql \connect command. - This command actually opens a new connection, which might - require manual interaction (e.g., passwords). If you use the - option, then - pg_dump will instead output commands. This has - the same effect, but it requires that the user restoring the - database from the generated script be a database superuser. - This option effectively overrides the - option. - - - - Since is a - standard SQL command, whereas \connect only - works in psql, this option also enhances - the theoretical portability of the output script. - - - - This option is only meaningful for the plain-text format. For - the other formats, you may specify the option when you - call pg_restore. + This option is obsolete but still accepted for backwards + compatibility. + pg_dump now always behaves in the + way formerly selected by this option. @@ -490,10 +448,8 @@ PostgreSQL documentation Presently, the commands emitted for diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index 1600925af84..88319e2e344 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -1,4 +1,4 @@ - + @@ -261,10 +261,16 @@ - Prevent any attempt to restore original object - ownership. Objects will be owned by the user name used to - attach to the database. See also under and - . + Do not output commands to set + ownership of objects to match the original database. + By default, pg_restore issues + SET SESSION AUTHORIZATION + statements to set ownership of created schema elements. + These statements will fail unless the initial connection to the + database is made by a superuser + (or the same user that owns all of the objects in the script). + With , any user name can be used for the + initial connection, and this user will own all the created objects. @@ -311,20 +317,8 @@ - While restoring an archive, pg_restore - typically has to reconnect to the database several times with - different user names to set the correct ownership of the - created objects. If this is undesirable (e.g., because manual - interaction (passwords) would be necessary for each - reconnection), this option prevents - pg_restore from issuing any reconnection - requests. (A connection request while in plain text mode, not - connected to a database, is made by putting out a \connect command.) - However, this option is a rather blunt instrument because it - makes pg_restore lose all object ownership - information, unless you use the - option. + This option is obsolete but still accepted for backwards + compatibility. @@ -397,16 +391,10 @@ - Normally, if restoring an archive requires altering the - current database user (e.g., to set correct object - ownerships), a new connection to the database must be opened, - which might require manual interaction (e.g., passwords). If - you use the option, - then pg_restore will instead use the command. This has - the same effect, but it requires that the user restoring the - archive is a database superuser. This option effectively - overrides the option. + This option is obsolete but still accepted for backwards + compatibility. + pg_restore now always behaves in the + way formerly selected by this option. @@ -428,8 +416,7 @@ Presently, the commands emitted for -- cgit v1.2.3