alter_database 中文man頁面
NAME
ALTER DATABASE - 修改一個數據庫
SYNOPSIS
ALTER DATABASE name SET parameter { TO | = } { value | DEFAULT } ALTER DATABASE name RESET parameter ALTER DATABASE name RENAME TO newname
DESCRIPTION 描述
ALTER DATABASE 用于改變一個數據庫的屬性。
頭兩種形式為 PostgreSQL 數據庫修改缺省的會話運行時配置變量。 隨后在該數據庫上啟動一個新的會話的時候, 在啟動會話之前先有效地運行 SET variable TO value。 數據庫相關的缺省值覆蓋任何在 postgresql.conf 里出現或者從 postmaster 命令行接收到的設置。 只有數據庫所有者或者超級用戶可以為一個數據庫修改會話缺省。
第三種形式修改該數據庫的名稱。只有數據庫所有者可以重命名一個數據庫,并且只有在他有 CREATEDB 權限的時候可以。 當前的數據庫不能被重命名。(如果你需要這么做,那么連接另外一個數據庫。)
PARAMETERS 參數
- name
需要修改會話缺省的數據庫的名字。- parameter
- value
把指定的數據庫配置變量的會話缺省值設置為給出的數值。 如果 value 使用了 DEFAULT 或者是等效的 RESET, 那么與數據庫相關的變量設置將被刪除并且在新的會話中將繼承缺省設置。 用 RESET ALL 清除所有設置。
參閱 SET [set(7)] 和 Section 16.4 ``Run-time Configuration'' 獲取有關允許的變量名和數值的 更多信息。- newname
數據庫的新名字。
NOTES 注意
使用 ALTER USER [alter_user(7)], 我們也可以把一個會話缺省綁定到一個特定用戶,而不是某個數據庫上。 如果存在沖突,那么用戶聲明的設置覆蓋數據庫相關的設置。
EXAMPLES 例子
要關閉在數據庫 test 上缺省的索引使用∶
ALTER DATABASE test SET enable_indexscan TO off;
COMPATIBILITY 兼容性
ALTER DATABASE 語句是一個 PostgreSQL 擴展。
SEE ALSO 參見
ALTER USER [alter_user(7)], CREATE DATABASE [create_database(l)], DROP DATABASE [drop_database(l)], SET [set(l)]
#p#
NAME
ALTER DATABASE - change a database
SYNOPSIS
ALTER DATABASE name SET parameter { TO | = } { value | DEFAULT } ALTER DATABASE name RESET parameter ALTER DATABASE name RENAME TO newname
DESCRIPTION
ALTER DATABASE is used to change the attributes of a database.
The first two forms change the session default of a run-time configuration variable for a PostgreSQL database. Whenever a new session is subsequently started in that database, the specified value becomes the session default value. The database-specific default overrides whatever setting is present in postgresql.conf or has been received from the postmaster command line. Only the database owner or a superuser can change the session defaults for a database.
The third form changes the name of the database. Only the database owner can rename a database, and only if he has the CREATEDB privilege. The current database cannot be renamed. (Connect to a different database if you need to do that.)
PARAMETERS
- name
- The name of the database whose session defaults are to be altered.
- parameter
- value
- Set the session default for this database of the specified configuration parameter to the given value. If value is DEFAULT or, equivalently, RESET is used, the database-specific variable setting is removed and the system-wide default setting will be inherited in new sessions. Use RESET ALL to clear all settings.
See SET [set(7)] and the section called ``Run-time Configuration'' in the documentation for more information about allowed parameter names and values.
- newname
- The new name of the database.
NOTES
Using ALTER USER [alter_user(7)], it is also possible to tie a session default to a specific user rather than a database. User-specific settings override database-specific ones if there is a conflict.
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
ALTER USER [alter_user(7)], CREATE DATABASE [create_database(l)], DROP DATABASE [drop_database(l)], SET [set(l)]