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

p g b a s h

Pgbash is a BASH shell which includes the functionality of accessing the database for PostgreSQL. It is possible to execute SQL by making a shell script in the batch processing, and execute SQL directly in the interactive environment. And, Pgbash has the functionality for making the simple Web application.

[Japanese] [English]

The latest version of Pgbash is as follows.

pgbash-8r2.05 ... based on bash-2.05a
pgbash-8r3.2 ... based on bash-3.2.48
pgbash-8r4.1 ... based on bash-4.1.10

pgbashrc-7.4 ... for PostgreSQL-7.4
pgbashrc-8.1 ... for PostgreSQL-8.1
pgbashrc-8.2 ... for PostgreSQL-8.2
pgbashrc-8.3 ... for PostgreSQL-8.3
pgbashrc-8.4 ... for PostgreSQL-8.4
pgbashrc-9.0 ... for PostgreSQL-9.0

Outline of Pgbash
  • Database Interface
    Pgbash has "Direct/Embedded SQL" interface for PostgreSQL. Here, "direct SQL" means the functionality which execute immediately and outputs the results to standard output. And, "Embedded SQL" means the functionality which sets the retrieval result into the shell variables which are processed by using shell script language. Pgbash can use SELECT_INTO or FETCH_INTO statement as "Embedded SQL" interfaces.

  • Execute SQL on the Interactive environment
    When Pgbash had been started as a LOGIN_shell or a SUB_shell, it is possible to execute SQL immediately. And, it is possible to execute SQL with pipeline, redirection and background_job options.

  • Shell script and Web application
    You can make a shell script with SQL and the control statements such as IF/WHILE and the shell variables using Pgbash. Pgbash has the functionality of inputting data from GET/POST method and ouputting data to HTML table, in order to use a shell script as a Web application.

    The load of the server is higher on the CGI program using Pgbash than on the PHP which is a built-in module of the web server software. So, Pgbash is suited for a Web application of a few access, or a prototype system before making a real Web application.

  • Operation environment
    Pgbash needs the libpq library of PostgreSQL. So, you must describe the path of libpq library in the parent shell. And, Pgbash needs Pgbashrc when Pgbash starts in the interactive environment.

    (What is Pgbashrc)
    Pgbashrc is the shell startup file which sets the various commands for displaying the database information. Pgbash can either use a original Pgbashrc file or modified Pgbashrc file.

Featurs of Pgbash
  • Interactive environment.
    1. Pgbash has a database accessing function equivalent to psql.
    2. Pgbash can set up a user's original interactive environment using pgbashrc.
    3. Pgbash can offer flexible interactive environment, such as alias, function, and history.
    4. Pgbash can execute the SQL statement with pipeline, redirection and background_job options.

  • Extension of SQL.
    1. Pgbash can connect to some databases by using CONNECT, DISCONNECT and SET CONNECTION.
    2. Pgbash has the functionality which sets the retrieval result into the shell variable by using SELECT_INTO/FETCH_INTO statements.
    3. Pgbash keeps the error code after SQL execution, the number of tuples as a result of SELECT, the number of colums and the number of records, to a shell variable. Therefore, it is possible to know the condition after the SQL execution.

  • Web application.
    1. Pgbash has the functionality of changing HTML output mode, reading data from GET/POST method and reading values from HTTP_COOKIE.
    2. Pgbash can print the retrieval results as HTML table format. And, Pgbash can change TABLE tag, HEADER tag, TR tag, TH tag, TD tag.

  • 1999.07.01 : An interface was discussed at pgsql-jp ML.
  • 1999.07.15 : KUBO Takehiro opens pqbash to the public by pgsql-jp ML.
  • 1999.07.30 : The examination of Pgbash was started.
  • 1999.08.31 : pgbash-1.0-beta released.
  • 1999.09.06 : pgbash-1.0b2 released.
  • 1999.10.01 : pgbash-1.1.1 released.
  • 1999.10.30 : pgbash-1.2.1 released.
  • 1999.10.31 : pgbash-1.2.2 released. (pgbash-1.2.1 bug fix)
  • 1999.11.22 : pgbash-1.2.3 released.
  • 1999.12.25 : pgbash-2.0 released. (bash-2.03 main body was patched)
  • 2000.01.07 : pgbash-2.0.1 released. (Add Multibyte function, Stop System mesages)
  • 2000.05.16 : pgbash-2.1(bash-2.03) released (for PostgreSQL-6.5/7.0)
  • 2001.05.01 : pgbash-2.2(bash-2.03/2.04/2.05) was released (for PostgreSQL-6.5/7.0/7.1)
  • 2001.12.15 : pgbash-2.4 released. (for PostgreSQL-7.0/7.1/7.2)
  • 2002.02.10 : pgbash-2.4a released. (for bash-2.05a)
  • 2002.05.10 : pgbash-2.4a.1 released.
  • 2002.07.22 : pgbash-2.4a.2 released.
  • 2003.02.11 : pgbash-7.3 released. (for PostgreSQL-7.3)
  • 2003.10.14 : pgbash-7.3a released( for pgbash-7.3 bug fix) by Tomo Nomura.
  • 2011.08.15 : pgbash-8r2.05 released. (for PostrgeSQL 8.0 or later)
  • 2011.08.20 : pgbash-8r3.2 released. (for PostrgeSQL 8.0 or later)
  • 2011.08.25 : pgbash-8r4.1 released. (for PostrgeSQL 8.0 or later)

Link pages

SAKAIDA Masaaki<sakaida@psn.co.jp>
Last Modified at 2011/08/25
# Sorry, I am not good at English.