PostgreSQL
PostgreSQL PostgreSQL is a powerful relational database management system (rdbms) that is similar to Ingres. PostgreSQL is an enhancement of the original POSTGRES database management system, a next-generation DBMS research prototype. While PostgreSQL retains the powerful data model and rich data types of POSTGRES, it replaces the PostQuel query language with an extended subset of SQL.

PostgreSQL is currently provided free of charge to our Virtual Server Administrators. While this is being provided free of charge, we recommend that you take the time to register at the PostgreSQL website.

NOTE: PostgreSQL has been unreliable on our Virtual Servers running BSD/OS and may still be on our new Virtual Servers running FreeBSD O/S. Until there is a fix for this, we recommend that use MySQL instead.

Installing PostgreSQL

  1. Add the following lines to your shell startup file. To find out which shell you are using, type

    % echo $SHELL

    and the name of the shell will appear.

    1. If you are using /bin/csh or one of its variants, then add the following lines to the ~/.cshrc file on your Virtual Server:

      setenv PGDATA /usr/local/pgsql/data
      setenv PGLIB /usr/local/pgsql/lib
      setenv LD_LIBRARY_PATH /usr/local/pgsql/lib
      set path = (/usr/local/pgsql/bin $path)
      

    2. If you are using the Bourne shell (/bin/sh or /bin/bash) then add the following lines to the ~/.profile file on your Virtual Server:

      PATH=$PATH:/usr/local/pgsql/bin
      PGDATA=/usr/local/pgsql/data
      PGLIB=/usr/local/pgsql/lib
      LD_LIBRARY_PATH=/usr/local/pgsql/lib
      export PGDATA PGLIB LD_LIBRARY_PATH
      

  2. Run the PostgreSQL installation script that matches your Virtual Server O/S:

    FreeBSD
    % vinstall pgsql
    

    BSD/OS
    % installpgsql
    

    NOTE: If your Virtual Server was ordered after Nov 22, 1999, you are likely running FreeBSD. To find out which O/S your Virtual Server is running, use the uname command:

    % uname
    

    These installation scripts install all the necessary PostgreSQL files and initialize a database with the same name as your user name. They also start the postmaster daemon running.

  3. The main tool for using PostgreSQL is the psql client server. To start it type:

    FreeBSD
    % virtual psql
    

    BSD/OS
    % psql
    

    The psql client server will start up and you will be able to type in SQL code and ask for help.

    If you get the following error:

    Connection to database '(null)' failed.
    FATAL: PQsetdb: Unable to determine a Postgres username!
    

    all you need to do is type:

    % vpwd_mkdb ~/etc/passwd

    This program will read your password file at ~/etc/passwd and create a Berkeley DB format file. PostgreSQL uses this new file to look up user names and account information.

Uninstalling PostgreSQL
To uninstall PostgreSQL on your Virtual Server, connect to your Virtual Server via Telnet or SSH and do the following:

% cd ~/usr/local
% chmod -R u+w pgsql
% rm -rf pgsql

Next, edit your ~/etc/rc file and remove the line that contains postgresql. Then run the ps command, like this:

% ps -x

Locate the process ID of the PostgreSQL daemon and use kill to stop the PostgreSQL daemon:

% kill process_ID

Documentation and Support
See the PostgreSQL Documentation and FAQs


Copyright © 1996-2000, Last Modified: 21 January 2000A Little Technology Shoppe, LLC (ALTS.NET)®. All rights reserved. All brand names and product names used on these web pages are trademarks, or trade names of their respective holders.