2 $PostgreSQL: pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.11 2003/11/29 19:51:38 pgsql Exp $
3 PostgreSQL documentation
6 <refentry id="SQL-ALTERDATABASE">
8 <refentrytitle id="sql-alterdatabase-title">ALTER DATABASE</refentrytitle>
9 <refmiscinfo>SQL - Language Statements</refmiscinfo>
13 <refname>ALTER DATABASE</refname>
14 <refpurpose>change a database</refpurpose>
17 <indexterm zone="sql-alterdatabase">
18 <primary>ALTER DATABASE</primary>
23 ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET <replaceable>parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
24 ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET <replaceable>parameter</replaceable>
26 ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>newname</replaceable>
31 <title>Description</title>
34 <command>ALTER DATABASE</command> is used to change the attributes
39 The first two forms change the session default of a run-time
40 configuration variable for a <productname>PostgreSQL</productname>
41 database. Whenever a new session is subsequently started in that
42 database, the specified value becomes the session default value.
43 The database-specific default overrides whatever setting is present
44 in <filename>postgresql.conf</> or has been received from the
45 <command>postmaster</command> command line. Only the database
46 owner or a superuser can change the session defaults for a
51 The third form changes the name of the database. Only the database
52 owner can rename a database, and only if he has the
53 <literal>CREATEDB</literal> privilege. The current database cannot
54 be renamed. (Connect to a different database if you need to do
60 <title>Parameters</title>
64 <term><replaceable class="PARAMETER">name</replaceable></term>
67 The name of the database whose session defaults are to be altered.
73 <term><replaceable>parameter</replaceable></term>
74 <term><replaceable>value</replaceable></term>
77 Set the session default for this database of the specified
78 configuration parameter to the given value. If
79 <replaceable>value</replaceable> is <literal>DEFAULT</literal>
80 or, equivalently, <literal>RESET</literal> is used, the
81 database-specific variable setting is removed and the system-wide
83 setting will be inherited in new sessions. Use <literal>RESET
84 ALL</literal> to clear all settings.
88 See <xref linkend="sql-set" endterm="sql-set-title"> and <xref linkend="runtime-config">
89 for more information about allowed parameter names
96 <term><replaceable>newname</replaceable></term>
99 The new name of the database.
110 Using <xref linkend="sql-alteruser" endterm="sql-alteruser-title">,
111 it is also possible to tie a session default to a specific user
112 rather than a database. User-specific settings override database-specific
113 ones if there is a conflict.
118 <title>Examples</title>
121 To disable index scans by default in the database
122 <literal>test</literal>:
125 ALTER DATABASE test SET enable_indexscan TO off;
131 <title>Compatibility</title>
134 The <command>ALTER DATABASE</command> statement is a
135 <productname>PostgreSQL</productname> extension.
140 <title>See Also</title>
142 <simplelist type="inline">
143 <member><xref linkend="sql-alteruser" endterm="sql-alteruser-title"></member>
144 <member><xref linkend="sql-createdatabase" endterm="sql-createdatabase-title"></member>
145 <member><xref linkend="sql-dropdatabase" endterm="sql-dropdatabase-title"></member>
146 <member><xref linkend="sql-set" endterm="sql-set-title"></member>
151 <!-- Keep this comment at the end of the file
156 sgml-minimize-attributes:nil
157 sgml-always-quote-attributes:t
160 sgml-parent-document:nil
161 sgml-default-dtd-file:"../reference.ced"
162 sgml-exposed-tags:nil
163 sgml-local-catalogs:"/usr/lib/sgml/catalog"
164 sgml-local-ecat-files:nil