From 1aac2c852a2ccd817daf2dac99cf450e7822eb20 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 1 Mar 2002 22:45:19 +0000 Subject: User and database-specific session defaults for run-time configuration variables. New commands ALTER DATABASE ... SET and ALTER USER ... SET. --- doc/src/sgml/catalogs.sgml | 16 +++- doc/src/sgml/ref/allfiles.sgml | 3 +- doc/src/sgml/ref/alter_database.sgml | 169 +++++++++++++++++++++++++++++++++++ doc/src/sgml/ref/alter_user.sgml | 53 ++++++++++- doc/src/sgml/reference.sgml | 3 +- doc/src/sgml/release.sgml | 4 +- doc/src/sgml/runtime.sgml | 11 ++- 7 files changed, 248 insertions(+), 11 deletions(-) create mode 100644 doc/src/sgml/ref/alter_database.sgml (limited to 'doc/src') diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 20adc19bab8..aab0a906d9b 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1,6 +1,6 @@ @@ -889,6 +889,13 @@ or an absolute path, depending how it was entered. + + + datconfig + text[] + + Session defaults for run-time configuration variables + @@ -1980,6 +1987,13 @@ Account expiry time (only used for password authentication) + + + useconfig + text[] + + Session defaults for run-time configuration variables + diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml index ef29c0e8b98..94f1226c24f 100644 --- a/doc/src/sgml/ref/allfiles.sgml +++ b/doc/src/sgml/ref/allfiles.sgml @@ -1,5 +1,5 @@ @@ -37,6 +37,7 @@ Complete list of usable sgml source files in this directory. + diff --git a/doc/src/sgml/ref/alter_database.sgml b/doc/src/sgml/ref/alter_database.sgml new file mode 100644 index 00000000000..b1aa34262a1 --- /dev/null +++ b/doc/src/sgml/ref/alter_database.sgml @@ -0,0 +1,169 @@ + + + + + ALTER DATABASE + SQL - Language Statements + + + + ALTER DATABASE + change a database + + + + +ALTER DATABASE name SET variable { TO | = } { value | DEFAULT } +ALTER DATABASE name RESET variable + + + + + Description + + + ALTER DATABASE is used to change the session + default of a run-time configuration variable for a + PostgreSQL database. Whenever a new + session is subsequently started, SET + variable TO + value is effectively executed + before the start of the session. + + + + Only a database owner can change the session defaults for a + database. Superusers can change the session defaults of any + database. + + + + Parameters + + + + + name + + + The name of the database whose session defaults are to be altered. + + + + + + variable + value + + + Set the session default for this database of the specified + configuration variable to the given value. If + value is DEFAULT + or, equivalently, RESET is used, the + database-specific variable setting is removed and the default + setting will be inherited in new sessions. Use RESET + ALL to clear all settings. + + + + See and the + Administrator's Guide for more + information about allowed variable names and values. + + + + + + + + + + Diagnostics + + + + + ALTER DATABASE + + + Message returned if the alteration was successful. + + + + + + ERROR: database "dbname" does not exist + + + Error message returned if the specified database is not known + to the system. + + + + + + + + + Notes + + + Using , + it is also possible to tie a session default to a specific user + rather than a database. + + + + + Examples + + + To disable index scans by default in the database + test: + + +ALTER DATABASE test SET enable_indexscan TO off; + + + + + + Compatibility + + + The ALTER DATABASE statement is a + PostgreSQL extension. + + + + + See Also + + + + + + + + + + + diff --git a/doc/src/sgml/ref/alter_user.sgml b/doc/src/sgml/ref/alter_user.sgml index 0156565eb50..3819bf8d964 100644 --- a/doc/src/sgml/ref/alter_user.sgml +++ b/doc/src/sgml/ref/alter_user.sgml @@ -1,5 +1,5 @@ @@ -24,6 +24,9 @@ where option can be: | CREATEDB | NOCREATEDB | CREATEUSER | NOCREATEUSER | VALID UNTIL 'abstime' + +ALTER USER username SET variable { TO | = } { value | DEFAULT } +ALTER USER username RESET variable @@ -37,9 +40,22 @@ where option can be: - Only a database superuser can change privileges and password - expiration with this command. Ordinary users can only change their - own password. + The first variant of this command in the synopsis changes certain + global user privileges and authentication settings. (See below for + details.) Only a database superuser can change privileges and + password expiration with this command. Ordinary users can only + change their own password. + + + + The second and the third variant change a user's session default of + a specified configuration variable. Whenever the user subsequently + starts a new session, SET + variable TO + value is effectively executed + before the start of the session. Ordinary users can change their + own session defaults. Superusers can change anyone's session + defaults. @@ -113,6 +129,28 @@ where option can be: + + + variable + value + + + Set this user's session default of the specified configuration + variable to the given value. If + value is DEFAULT + or, equivalently, RESET is used, the + user-specific variable setting is removed and the user will + inherit the default setting in new sessions. Use + RESET ALL to clear all settings. + + + + See and the + Administrator's Guide for more + information about allowed variable names and values. + + + @@ -159,6 +197,12 @@ where option can be: Use to do that. + + + Using , it is also possible to tie a + session default to a specific database rather than a user. + @@ -214,6 +258,7 @@ ALTER USER miriam CREATEUSER CREATEDB; + diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml index a5b8cfbf163..27f218d33fb 100644 --- a/doc/src/sgml/reference.sgml +++ b/doc/src/sgml/reference.sgml @@ -1,5 +1,5 @@ @@ -46,6 +46,7 @@ PostgreSQL Reference Manual &abort; + &alterDatabase; &alterGroup; &alterTable; &alterUser; diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index edcdc9405aa..3801b8d1eab 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ @@ -28,6 +28,8 @@ Access privileges on functions Access privileges on procedural languages CREATE DATABASE has OWNER option so superuser can create DB for someone else Kerberos 5 support now works with Heimdal +Database and user-specific session defaults of run-time configurations variables + (ALTER DATABASE ... SET and ALTER USER ... SET) ]]> diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 2c0441fdcc9..3f46a3e9e4f 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,5 +1,5 @@ @@ -537,12 +537,17 @@ env PGOPTIONS='-c geqo=off' psql - Finally, some options can be changed in individual SQL sessions - with the SET command, for example + Some options can be changed in individual SQL sessions with the + SET command, for example => SET ENABLE_SEQSCAN TO OFF; See the SQL command language reference for details on the syntax. + Furthermore, it is possible to assign a set of option settings to + a user or a database. Whenever a session is started, the default + settings for the user and database involved are loaded. The + commands ALTER DATABASE and ALTER + USER, respectively, are used to set this up. -- cgit v1.2.3