[Home] [Download] [Install] [Usage] [Example] [FAQ]

Installation of Pgbash

This page explains about the installation and the confirmation way of Pgbash.

Confirmation of the installation of PostgreSQL
    Before installing Pgbash, PostgreSQL-6.5/7.0/7.1 must be installed in advance. Pgbash is on the assumption that PostgreSQL is installed in the "/usr/local/pgsql" directory.

    If PostgreSQL is not in that directory, please make the '/usr/local/pgsql' directory as follows, And please do the symbolic link for 'lib' and 'include'.

    cd /usr/local
    mkdir pgsql
    cd pgsql
    ln -s xxxx/pgsql/lib
    ln -s xxxx/pgsql/include

    Here, "xxxx/pgsql" shows the directory in which PostgreSQL exists actually.

Installation of Pgbash
  1. Unpacking the pgbash-2.2 and bash-2.0x

    tar xfz pgbash-2.2.tar.gz ( or gzip -dc pgbash-2.2.tar.gz | tar xf -)
    cd pgbash-2.2
    tar xfz yyyy/bash-2.0x.tar.gz

    Here, bash-2.0x shows bash-2.03/2.04/2.05. And "yyyy" shows the directory in which bash-2.0x.tar.gz exists actually.

    Unpacking pgbash-2.2 and e.g. bash-2.05, the following directorys and files are made in the pgbash-2.2 directory .
    -rw-r--r--   1 pgbash  postgres     2842 Apr 18 19:04 ChangeLog
    -rw-r--r--   1 pgbash  postgres     7245 Apr 18 19:04 INSTALL
    -rw-r--r--   1 pgbash  postgres     4404 Apr 18 19:04 README
    drwxr-xr-x  10 pgbash  postgres     3584 Apr 21 16:15 bash-2.05/
    drwxr-xr-x   4 pgbash  postgres     1024 Apr 21 16:14 exec_sql/
    lrwxrwxrwx   1 pgbash  postgres        9 Apr 20 11:05 patch@ -> patch-2.05
    drwxr-xr-x   2 pgbash  postgres      512 Apr 21 17:18 patch-2.03/
    drwxr-xr-x   2 pgbash  postgres      512 Apr 21 17:18 patch-2.04/
    drwxr-xr-x   2 pgbash  postgres      512 Apr 21 17:18 patch-2.05/
    -rw-r--r--   1 pgbash  postgres     3301 Apr 21 09:28 pgbashrc
    lrwxrwxrwx   1 pgbash  postgres        9 Apr 20 11:05 src@ -> bash-2.05
    drwxr-xr-x   4 pgbash  postgres      512 Apr 19 17:11 test/
    

  2. Apply the bash-2.0x patch

    cd patch-2.0x
    make

    Please select the patch-2.0x directory. If the version is 2.05 then you can type 'cd patch'. The result of the patch is recorded for "make.log" file, when make is executed.

  3. Configure

    cd ../bash-2.0x
    ./configure

    Please select the bash-2.0x directory. If the version is 2.05 then you can type 'cd src'. The bash-2.0x default compilation flag is "-g -O2". In the case of default, Pgbash program size will be about 2.1MB. If the compilation flag is "-O2", its size will be about 620KB. Therefore, pgbash-2.2 patch delete the "-g" option.

  4. make (GNU make)

    After configuration, type 'make' (or gmake). "Pgbash" is made in the bash-2.0x directory. (You must use the GNU make.)

  5. make install

    Type 'su' and type 'make install'. The 'pgbash' is copied to /usr/local/bin directory and the 'pgbashrc' is copied to /etc directory.
    pgbash-2.2/bash-2.0x/pgbash  ==> /usr/local/bin/pgbash
    pgbash-2.2/pgbashrc          ==> /etc/pgbashrc
    
    If you can not work in Unix super user, you must copy 'pgbash' and 'pgbashrc' to the appropriate directory.

Environment
    Some environment setting are required when Pgbash is used as a sub shell.

  1. Setting of "~/.bashrc"

    Write a general environment in ~/.bashrc. If you are a postgres supper user then you must describe the following.

    (In the case of postgres supper user)
    # ~/.bashrc
    export POSTGRES_HOME=/usr/local/pgsql
    export PGLIB=$POSTGRES_HOME/lib
    export PGDATA=$POSTGRES_HOME/data
    export LD_LIBRARY_PATH=$PGLIB
    export PATH=/usr/local/bin:/usr/local/pgsql/bin:$PATH
    ...
    

    If the database encoding is 'EUC_JP' and client encoding is 'SJIS', you could define "export PGCLIENTENCODING= 'SJIS'" or you could execute "set client_encoding='SJIS';" after connecting to database.

  2. Setting of ~/.pgbashrc

    You must copy /etc/pgbashrc to ~/.pgbashrc. You may modify the ~/.pgbashrc.

  3. Confirmation of the environment setting

    Please type '/usr/local/bin/pgbash' and type '?'. It will be displayed as follows.
    prompt> /usr/local/bin/pgbash
    Welcome to Pgbash version 2.2 ( bash-2.05.0(1)-release )
    
      Type '?' for HELP. (HELP is defined in ~/.pgbashrc)
      Type 'connect to DB;' before executing SQL.
      Type 'SQL;' to execute SQL.
      Type 'exit' or 'Ctrl+D' to terminate Pgbash.
    
    pgbash> ?
      ?         : this help
      ??        : help pgbash usage
      ??h [SQL] : help SQL(or "SQL") syntax or all SQL reserved words
      ??e       : help SQLCODE (sql ERROR code)
      ??f       : help 'pgbashrc' FUNCTIONs for using a shell script
      ??o       : help 'exec_sql' options
      ?m        : show CONNECTION NAMEs
      ....
    

Test of Pgbash.

  1. Add Pgbash user for PostgreSQL

    createuser pgbash
    Is user "pgbash" allowed to create databases (y/n) y
    Is user "pgbash" a superuser? (y/n) n
    
  2. make

    cd test
    make PostrgeSQL_Version (e.g. 'make 7.1')

    Please type 'make PostreSQL_Version'. If you want to test again, you have to type 'make clean' and 'make'.

    Only "./check-All.bat" is displayed or some "No Differences encountered" are displayed, then pgbash will be rightly operated.

Test in various software environments

  • pgbash-2.2
    • FreeBSD-3.4, gcc-2.7.2, PostgreSQL-7.1/7.0.3
    • RedHat Linux 7.0J, gcc-2.96, PostgreSQL-7.1
    • RedHat Linux 6.1J, gcc-2.91, PostgreSQL-6.5.3
      SAKAIDA Masaaki(sakaida@psn.co.jp) confirmed it.
    • Plamo-Linux 2.0, PostgreSQL-7.1/7.1.1, bash-2.04-readline-i18n-20000814.patch
      KUWAMURA-san(juk@rccm.co.jp) has installed.
      He reports that "(-403)ERROR: DROP DATABASE: database "pgbash_db1" is being accessed by other users" message is displayed in the Pgbash test. Thank you for your report.
      (But, please ignore this error. This is a problem of Pgbash test script. Pgbash is no problem.)

  • pgbash-2.1
    • FreeBSD-2.2.7, gcc-2.7.2, PostgreSQL-7.0
    • redhat5.2(Japan) Linux, gcc-2.95.2, PostgreSQL-6.5.3
      SAKAIDA Masaaki(sakaida@psn.co.jp) confirmed it.
    • Solaris 8 for Intel, gcc, PostgreSQL-7.0.2
      IUCHI-sann(iuchi@ml3.yano-el.co.jp) confirmed it, thanks.
      He reported that "CC=gcc" was needed in "pgbash/exec_sql/Makefile".

  • pgbash-2.0.x
    • FreeBSD-2.2.7, gcc-2.7.2, PostgreSQL-6.5.2
    • redhat5.2(Japan) Linux, gcc-2.95.2, PostgreSQL-6.5.1
      SAKAIDA Masaaki(sakaida@psn.co.jp) confirmed it.
    • FreeBSD 3.3 Rel, gcc-2.95.2, PostgreSQL-6.5.3
      ICHIMURA-sann(ichimura@jimu.hokudai.ac.jp) confirmed it, thanks.
    • Unixware7.1.0, gcc-2.95.1, PostgreSQL-6.5.3
      HONDA-sann(fwif0083@mb.infoweb.ne.jp) confirmed it, thanks.
      He reported that he have changed from default patch to GNU patch-2.5.4.
    • RedHat 5.2J for x86, gcc 2.7.2.3, PostgreSQL 6.5.3
      ISHII-sann(t-ishii@sra.co.jp) confirmed it. Thanks.
    • Plamo Linux 2.0 beta1(Kernel-2.2.13), egcs-1.1.2, PostgreSQL-6.5.3
      KUWAMURA-sann(juk@rccm.co.jp) confirm it. Thanks
    • Cygwin
      TANIDA-sann(yutaka@marin.or.jp) made pgbash-2.0.x on cygwin.
      http://www.s34.co.jp/~luster/pgsql/pgbash-2.0.1-cygwinB20.1.tar.gz
      http://www.s34.co.jp/~luster/pgsql/pgbash-2.0-cygwinB20.1.tar.gz

  • pgbash-1.x (exec_sql functions)
    • FreeBSD-2.2.7, gcc-2.7.2, PostgreSQL-6.5.2, bash-2.02
    • FreeBSD-2.2.7, gcc-2.7.2, PostgreSQL-6.5.1, bash-2.02
    • FreeBSD-2.2.7, gcc-2.7.2, PostgreSQL-6.4.2, bash-2.02
    • redhat5.2(Japan) Linux, gcc-2.95.1, PostgreSQL-6.5.1, bash-2.03
      SAKAIDA Masaaki(sakaida@psn.co.jp) confirmed it.
    • UnixWare 7.1.0, gcc-2.95.1, postgres6.5.1, bash-2.0.3
    • Solaris 2.6 x86, gcc-2.8.2, PostgreSQL-6.5, bash-2.03
      HONDA-sann(fwif0083@mb.infoweb.ne.jp) confirmed it. Thanks.
    • Linux Vinec 1.1, gcc-2.7.2.3, PostgreSQL-6.5.0, bash-2.03
      KONDOU-sann(nkon@shonan.ne.jp) confirmed it. Thanks.
    • vine-1.1(CR) linux-2.0.36 gcc-2.7.2.3 PostgreSQL-6.5.2 bash-2.03
      NAKAMURA-sann(waasuke@e-mail.ne.jp) confirm it. Thanks.
    • SunOS 5.7 Intel, pgcc-2.91.66, PostgreSQL-6.5.1, bash-2.03
      AOKI-sann(toshi@saluda.kinotrope.co.jp) confirmed it. Thanks.
    • FreeBSD-3.2, gcc-2.95.1, PostgreSQL-6.5.1, bash-2.03
      ICHIMURA-sann(ichimura@jimu.hokudai.ac.jp) confirmed it. Thanks.
    • Slackware3.6.0(kernel2.0.35), gcc-2.7.2.3, PostgreSQL-6.5.1, bash2.02
      IIDA-sann(webmaster@art-co.com) confirmed it. Thanks.
    • LinuxPPC R4/kernel 2.2.1, egcs-2.90.25, PostgreSQL-6.5.1, bash-2.02
      ISHII-sann(t-ishii@sra.co.jp) confirmed it. Thanks.


[Home] [Download] [Install] [Usage] [Example] [FAQ]

Last Modified at 2001/05/01