                ** Installation of Pgbash **


Installation of Pgbash 
----------------------

0. Unpack pgbash-2.4a.2
1. Download and unpack 'bash-2.05a.tar.gz'

  (1) Change directory
      cd pgbash-2.4a.2/src

  (2) Download
      ftp://ftp.gnu.org/gnu/bash/bash-2.05a.tar.gz 

  (3) Unpack
      tar xfz  bash-2.05a.tar.gz
     (gzip -dc bash-2.05a.tar.gz | tar xf - )

  The 'src' directory is as follows.

  src/ -------+----- bash-2.05a/
              +----- bash-2.05a-patch/
              +----- exec_sql/

  (4) Symbolic link (Only PostgreSQL-7.0 and 7.1)

   PostgreSQL-7.2 has changed 'config.h' into 'pg_config.h' in the
   PostrgeSQL 'include' directory(e.g. /usr/local/pgsql/include).
   So, Pgbash-2.4a.2 has changed the header file into 'pg_config.h'.

   Therefore, If you are using PostgreSQL-7.0/7.1, then you must 
   link the 'pg_config.h' into the 'config.h' as follows. 
   (In the case of 7.2, this symbolic link is unnecessary.)

   cd exec_sql
   ln -s /usr/local/pgsql/include/config.h  pg_config.h


2. Patch

  cd src/bash-2.05a-patch
  make

  Apply the bash-2.05a patch.  The result of the patch is recorded 
  for "make.log" file. Please confirm that the patch was normally 
  executed.

3. Configure

 (1) Configure

     cd src/bash-2.05a

     ************************
     CFLAGS='-O2' ./configure  <---- without debug option
     ************************
     or
     ./configure               <---- with debug option (CFLAGS='-g -O2')

 (2) Configure 'prefix' options

   If PostgreSQL is not installed into '/usr/local/pgsql' directory, 
   you must add --pginc-prefix and --pglib-prefix options.

   (Options)
   --pginc-prefix : Path of PostrgeSQL include files.
   --pglib-prefix : Path of PostgreSQL library files.

   (Default prefix value)
   --pginc-prefix=/usr/local/pgsql/include
   --pglib-prefix=/usr/local/pgsql/lib

   (Example)
   CFLAGS='-O2' ./configure --pginc-prefix=/usr/include/pgsql   \
               	            --pglib-prefix=/usr/lib

4. Make(You must use GNU make)  and make install

   make
   make install

   If you are not a Unix super user, then type 'su'. And type 
   'make install'.  The 'pgbash' is copied as follows.

   pgbash-2.4a.2/src/bash-2.05a/pgbash  ==> /usr/local/bin/pgbash
   pgbash-2.4a.2/rc/pgbashrc            ==> /etc/pgbashrc

  If you can not work in a Unix super user, you must copy 
  'pgbash' and pgbashrc to your home directory.

   cp pgbash-2.4a.2/src/bash-2.05a/pgbash   ~/pgbash
   cp pgbash-2.4a.2/rc/pgbashrc             ~/.pgbashrc


Environment
-----------

1. ~/.bashrc
   pgbash links "libpq.so" dynamically. Therefore, LD_LIBRARY_PATH 
   has to be described by ~/.bashrc file.

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

2. 'pgbashrc' file
   Pgbash tends to read ~/.pgbashrc. If it does not exist, Pgbash 
   tends to read /etc/pgbashrc.

   **********************************************************************
   If a old ~/.pgbashrc file exists, you must change it to a new pgbashrc.
   **********************************************************************


Execute
-------

   Type '/usr/local/bin/pgbash', then it will be displayed as following.

   prompt> /usr/local/bin/pgbash
   Welcome to Pgbash version 2.4a.2 ( bash-2.05a.-release )

     Type '?' for HELP.
     Type 'connect to DB;' before executing SQL.
     Type 'SQL;' to execute SQL.
     Type 'exit' or 'Ctrl+D' to terminate Pgbash.

   pgbash> exit

