<!--
-	This file currently contains several small chapters.
-	Each chapter should be split off into a separate source file...
-	- thomas 1998-02-24
-->

 <chapter id="newuser">
  <title>Adding and Deleting Users</title>

  <para>
   <application>createuser</application> enables specific users to access
   <productname>Postgres</productname>.  
   <application>dropuser</application> removes  users  and
   prevents them from accessing <productname>Postgres</productname>.
  </para>

  <para>
   These commands only affect users with  respect  to  
   <productname>Postgres</productname>;
   they  have  no effect on a user's other privileges or status with regards
   to the underlying  operating system.
  </para>
 </chapter>

 <chapter id="disk">
  <title>Disk Management</title>

  <sect1>
   <title>Alternate Locations</title>

   <para>
    It is possible to create a database in a location other than the default
    location for the installation. Remember that all database access actually
    occurs through the database backend, so that any location specified must
    be accessible by the backend.
   </para>

   <para>
    Alternate database locations are created and referenced by an environment variable
    which gives the absolute path to the intended storage location.
    This environment variable must have been defined before the backend was started
    and must be writable by the postgres administrator account.
    Any valid environment variable name may be used to reference an alternate 
    location, although using variable name with a prefix of PGDATA is recommended
    to avoid confusion and conflict with other variables.
   </para>

   <note>
    <para>
     In previous versions of <productname>Postgres</productname>, 
     it was also permissable to use an absolute path name
     to specify an alternate storage location.
     The environment variable style of specification
     is to be preferred since it allows the site administrator more flexibility in
     managing disk storage.
     If you prefer using absolute paths, you may do so by defining 
     "ALLOW_ABSOLUTE_DBPATHS" and recompiling <productname>Postgres</productname>
     To do this, either add this line

     <programlisting>
#define ALLOW_ABSOLUTE_DBPATHS 1
     </programlisting>

     to the file <filename>src/include/config.h</filename>, or by specifying

     <programlisting>
 CFLAGS+= -DALLOW_ABSOLUTE_DBPATHS
     </programlisting>

     in your <filename>Makefile.custom</filename>.
    </para>
   </note>

   <para>
    Remember that database creation is actually performed by the database backend.
    Therefore, any environment variable specifying an alternate location must have
    been defined before the backend was started. To define an alternate location
    PGDATA2 pointing to <filename>/home/postgres/data</filename>, first type

    <programlisting>
% setenv PGDATA2 /home/postgres/data
    </programlisting>

    to define the environment variable to be used with subsequent commands.
    Usually, you will want to define this variable in the 
    <productname>Postgres</productname> superuser's
    <filename>.profile</filename>
    or
    <filename>.cshrc</filename>
    initialization file to ensure that it is defined upon system startup. 
    Any environment variable can be used to reference alternate location, 
    although it is preferred that the variables be prefixed with "PGDATA" 
    to eliminate confusion and the possibility of conflicting with or 
    overwriting other variables.
   </para>

   <para>
    To create a data storage area in PGDATA2, ensure
    that <filename>/home/postgres</filename> already exists and is writable 
    by the postgres administrator.
    Then from the command line, type

    <programlisting>
% setenv PGDATA2 /home/postgres/data
% initlocation $PGDATA2
Creating Postgres database system directory /home/postgres/data

Creating Postgres database system directory /home/postgres/data/base

    </programlisting>

   </para>
   <para>
    To test the new location, create a database <database>test</database> by typing

    <programlisting>
% createdb -D PGDATA2 test
% dropdb test
    </programlisting>

   </para>
  </sect1>
 </chapter>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"./reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG"
sgml-local-ecat-files:nil
End:
-->
