]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/alter_database.sgml
Update SQL-command reference pages for schema features.
[postgresql] / doc / src / sgml / ref / alter_database.sgml
1 <!--
2 $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.2 2002/04/23 02:07:15 tgl Exp $
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-ALTERDATABASE">
7  <refmeta>
8   <refentrytitle id="sql-alterdatabase-title">ALTER DATABASE</refentrytitle>
9   <refmiscinfo>SQL - Language Statements</refmiscinfo>
10  </refmeta>
11
12  <refnamediv>
13   <refname>ALTER DATABASE</refname>
14   <refpurpose>change a database</refpurpose>
15  </refnamediv>
16
17  <refsynopsisdiv>
18 <synopsis>
19 ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET <replaceable>variable</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
20 ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET <replaceable>variable</replaceable>
21 </synopsis>
22  </refsynopsisdiv>
23
24  <refsect1>
25   <title>Description</title>
26
27   <para>
28    <command>ALTER DATABASE</command> is used to change the session
29    default of a run-time configuration variable for a
30    <productname>PostgreSQL</productname> database. Whenever a new
31    session is subsequently started in that database, <literal>SET
32    <replaceable>variable</replaceable> TO
33    <replaceable>value</replaceable></literal> is effectively executed
34    before the start of the session.  The database-specific default
35    overrides whatever setting is present in <filename>postgresql.conf</>
36    or has been received from the postmaster.
37   </para>
38
39   <para>
40    Only a superuser or the database owner can change the session defaults for a
41    database.
42   </para>
43
44   <refsect2>
45    <title>Parameters</title>
46
47    <para>
48     <variablelist>
49      <varlistentry>
50       <term><replaceable class="PARAMETER">name</replaceable></term>
51       <listitem>
52        <para>
53         The name of the database whose session defaults are to be altered.
54        </para>
55       </listitem>
56      </varlistentry>
57
58      <varlistentry>
59       <term><replaceable>variable</replaceable></term>
60       <term><replaceable>value</replaceable></term>
61       <listitem>
62        <para>
63         Set the session default for this database of the specified
64         configuration variable to the given value.  If
65         <replaceable>value</replaceable> is <literal>DEFAULT</literal>
66         or, equivalently, <literal>RESET</literal> is used, the
67         database-specific variable setting is removed and the default
68         setting will be inherited in new sessions.  Use <literal>RESET
69         ALL</literal> to clear all settings.
70        </para>
71
72        <para>
73         See <xref linkend="sql-set" endterm="sql-set-title"> and the
74         <citetitle>Administrator's Guide</citetitle> for more
75         information about allowed variable names and values.
76        </para>
77       </listitem>
78      </varlistentry>
79     </variablelist>
80    </para>
81   </refsect2>
82  </refsect1>
83
84  <refsect1>
85   <title>Diagnostics</title>
86
87   <para>
88    <variablelist>
89     <varlistentry>
90      <term><computeroutput>ALTER DATABASE</computeroutput></term>
91      <listitem>
92       <para>
93        Message returned if the alteration was successful.
94       </para>
95      </listitem>
96     </varlistentry>
97      
98     <varlistentry>
99      <term><computeroutput>ERROR:  database "dbname" does not exist</computeroutput></term>
100      <listitem>
101       <para>
102        Error message returned if the specified database is not known
103        to the system.
104       </para>
105      </listitem>
106     </varlistentry>
107    </variablelist>
108   </para>
109  </refsect1>
110
111  <refsect1>
112   <title>Notes</title>
113
114   <para>
115    Using <xref linkend="sql-alteruser" endterm="sql-alteruser-title">,
116    it is also possible to tie a session default to a specific user
117    rather than a database.  User-specific settings override database-specific
118    ones if there is a conflict.
119   </para>
120  </refsect1>
121
122  <refsect1>
123   <title>Examples</title>
124
125   <para>
126    To disable index scans by default in the database
127    <literal>test</literal>:
128
129 <programlisting>
130 ALTER DATABASE test SET enable_indexscan TO off;
131 </programlisting>
132   </para>
133  </refsect1>
134
135  <refsect1>
136   <title>Compatibility</title>
137     
138   <para>
139    The <command>ALTER DATABASE</command> statement is a
140    <productname>PostgreSQL</productname> extension.
141   </para>
142  </refsect1>
143
144  <refsect1>
145   <title>See Also</title>
146
147   <simplelist type="inline">
148    <member><xref linkend="sql-alteruser" endterm="sql-alteruser-title"></member>
149    <member><xref linkend="sql-createdatabase" endterm="sql-createdatabase-title"></member>
150    <member><xref linkend="sql-dropdatabase" endterm="sql-dropdatabase-title"></member>
151    <member><xref linkend="sql-set" endterm="sql-set-title"></member>
152   </simplelist>
153  </refsect1>
154 </refentry>
155
156 <!-- Keep this comment at the end of the file
157 Local variables:
158 mode: sgml
159 sgml-omittag:nil
160 sgml-shorttag:t
161 sgml-minimize-attributes:nil
162 sgml-always-quote-attributes:t
163 sgml-indent-step:1
164 sgml-indent-data:t
165 sgml-parent-document:nil
166 sgml-default-dtd-file:"../reference.ced"
167 sgml-exposed-tags:nil
168 sgml-local-catalogs:"/usr/lib/sgml/catalog"
169 sgml-local-ecat-files:nil
170 End:
171 -->