Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/alter_database.sgml`
3c4952539577fbcec86e80733a265bd0df7b6373d47650a30000000100000ea0
    </varlistentry>

      <varlistentry>
      <term><replaceable class="parameter">connlimit</replaceable></term>
      <listitem>
       <para>
        How many concurrent connections can be made
        to this database.  -1 means no limit.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
       <term><replaceable class="parameter">istemplate</replaceable></term>
       <listitem>
        <para>
         If true, then this database can be cloned by any user with <literal>CREATEDB</literal>
         privileges; if false, then only superusers or the owner of the
         database can clone it.
        </para>
       </listitem>
      </varlistentry>

   <varlistentry>
    <term><replaceable>new_name</replaceable></term>
    <listitem>
     <para>
      The new name of the database.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">new_owner</replaceable></term>
    <listitem>
     <para>
      The new owner of the database.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">new_tablespace</replaceable></term>
    <listitem>
     <para>
      The new default tablespace of the database.
     </para>

     <para>
      This form of the command cannot be executed inside a transaction block.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>REFRESH COLLATION VERSION</literal></term>
    <listitem>
     <para>
      Update the database collation version.  See <xref
      linkend="sql-altercollation-notes"/> for background.
     </para>
    </listitem>
   </varlistentry>

     <varlistentry>
      <term><replaceable>configuration_parameter</replaceable></term>
      <term><replaceable>value</replaceable></term>
      <listitem>
       <para>
        Set this database's session default for the specified configuration
        parameter to the given value.  If
        <replaceable>value</replaceable> is <literal>DEFAULT</literal>
        or, equivalently, <literal>RESET</literal> is used, the
        database-specific setting is removed, so the system-wide default
        setting will be inherited in new sessions.  Use <literal>RESET
        ALL</literal> to clear all database-specific settings.
        <literal>SET FROM CURRENT</literal> saves the session's current value of
        the parameter as the database-specific value.
       </para>

       <para>
        See <xref linkend="sql-set"/> and <xref linkend="runtime-config"/>
        for more information about allowed parameter names
        and values.
       </para>
      </listitem>
     </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Notes</title>

  <para>
   It is also possible to tie a session default to a specific role
   rather than to a database; see
   <xref linkend="sql-alterrole"/>.
   Role-specific settings override database-specific
   ones if there is a conflict.
  </para>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   To disable index scans by default in the database
   <literal>test</literal>:

<programlisting>
ALTER DATABASE test SET enable_indexscan TO off;
</programlisting></para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   The <command>ALTER DATABASE</command> statement is a
   <productname>PostgreSQL</productname> extension.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-createdatabase"/></member>
   <member><xref linkend="sql-dropdatabase"/></member>
   <member><xref linkend="sql-set"/></member>
   <member><xref linkend="sql-createtablespace"/></member>
  </simplelist>
 </refsect1>
</refentry>

Title: ALTER DATABASE: Parameters, Notes, Examples, and Compatibility
Summary
This section details the parameters for ALTER DATABASE, including connlimit, istemplate, new_name, new_owner, new_tablespace, and REFRESH COLLATION VERSION. It also covers setting database-specific configuration parameters with SET FROM CURRENT and resetting parameters. Notes mention role-specific settings overriding database settings. An example disables index scans in the 'test' database. The command is a PostgreSQL extension. Related commands are CREATE DATABASE, DROP DATABASE, SET, and CREATE TABLESPACE.