Imported upstream version 1.5
[manpages-zh.git] / raw / man7 / alter_database.7
blobc107e62f81ea0b73d597bc547a780d5e94402581
1 .\\" auto-generated by docbook2man-spec $Revision: 1.1 $
2 .TH "ALTER DATABASE" "7" "2003-11-02" "SQL - Language Statements" "SQL Commands"
3 .SH NAME
4 ALTER DATABASE \- change a database
6 .SH SYNOPSIS
7 .sp
8 .nf
9 ALTER DATABASE \fIname\fR SET \fIparameter\fR { TO | = } { \fIvalue\fR | DEFAULT }
10 ALTER DATABASE \fIname\fR RESET \fIparameter\fR
12 ALTER DATABASE \fIname\fR RENAME TO \fInewname\fR
13 .sp
14 .fi
15 .SH "DESCRIPTION"
16 .PP
17 \fBALTER DATABASE\fR is used to change the attributes
18 of a database.
19 .PP
20 The first two forms change the session default of a run-time
21 configuration variable for a PostgreSQL
22 database. Whenever a new session is subsequently started in that
23 database, the specified value becomes the session default value.
24 The database-specific default overrides whatever setting is present
25 in \fIpostgresql.conf\fR or has been received from the
26 \fBpostmaster\fR command line. Only the database
27 owner or a superuser can change the session defaults for a
28 database.
29 .PP
30 The third form changes the name of the database. Only the database
31 owner can rename a database, and only if he has the
32 CREATEDB privilege. The current database cannot
33 be renamed. (Connect to a different database if you need to do
34 that.)
35 .SH "PARAMETERS"
36 .TP
37 \fB\fIname\fB\fR
38 The name of the database whose session defaults are to be altered.
39 .TP
40 \fB\fIparameter\fB\fR
41 .TP
42 \fB\fIvalue\fB\fR
43 Set the session default for this database of the specified
44 configuration parameter to the given value. If
45 \fIvalue\fR is DEFAULT
46 or, equivalently, RESET is used, the
47 database-specific variable setting is removed and the system-wide
48 default
49 setting will be inherited in new sessions. Use RESET
50 ALL to clear all settings.
52 See SET [\fBset\fR(7)] and the section called ``Run-time Configuration'' in the documentation
53 for more information about allowed parameter names
54 and values.
55 .TP
56 \fB\fInewname\fB\fR
57 The new name of the database.
58 .SH "NOTES"
59 .PP
60 Using ALTER USER [\fBalter_user\fR(7)],
61 it is also possible to tie a session default to a specific user
62 rather than a database. User-specific settings override database-specific
63 ones if there is a conflict.
64 .SH "EXAMPLES"
65 .PP
66 To disable index scans by default in the database
67 test:
68 .sp
69 .nf
70 ALTER DATABASE test SET enable_indexscan TO off;
71 .sp
72 .fi
73 .SH "COMPATIBILITY"
74 .PP
75 The \fBALTER DATABASE\fR statement is a
76 PostgreSQL extension.
77 .SH "SEE ALSO"
78 ALTER USER [\fBalter_user\fR(7)], CREATE DATABASE [\fBcreate_database\fR(l)], DROP DATABASE [\fBdrop_database\fR(l)], SET [\fBset\fR(l)]