Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/alter_database.sgml`
aa0e6c3aef1427b5b4be12d65db96d78ee93125f6eba58510000000100000abc
 Only the database owner or a superuser can do this; you must also have
   create privilege for the new tablespace.
   This command physically moves any tables or indexes in the database's old
   default tablespace to the new tablespace.  The new default tablespace
   must be empty for this database, and no one can be connected to
   the database.  Tables and indexes in non-default tablespaces are
   unaffected.  The method used to copy files to the new tablespace
   is affected by the <xref linkend="guc_file_copy_method"/> setting.
  </para>

  <para>
   The remaining forms change the session default for a run-time
   configuration variable for a <productname>PostgreSQL</productname>
   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 <filename>postgresql.conf</filename> or has been received from the
   <command>postgres</command> command line.  Only the database
   owner or a superuser can change the session defaults for a
   database.  Certain variables cannot be set this way, or can only be
   set by a superuser.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

    <variablelist>
     <varlistentry>
      <term><replaceable class="parameter">name</replaceable></term>
      <listitem>
       <para>
        The name of the database whose attributes are to be altered.
       </para>
      </listitem>
     </varlistentry>

      <varlistentry>
       <term><replaceable class="parameter">allowconn</replaceable></term>
       <listitem>
        <para>
         If false then no one can connect to this database.
        </para>
       </listitem>
      </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

Title: ALTER DATABASE: Tablespaces, Configuration, and Parameters
Summary
ALTER DATABASE allows changing the default tablespace (requires empty tablespace and exclusive access) and setting session defaults for runtime configuration variables. The database owner or a superuser can perform these actions. Several parameters exist: 'name' specifies the database, 'allowconn' controls connections, 'connlimit' sets connection limits, 'istemplate' defines cloning permissions, and 'new_name' renames the database.