Next Previous Contents

15. PostgreSQL Management Tools

15.1 PGACCESS - A GUI Tool for PostgreSQL Management

PgAccess is a Tcl/Tk interface to PostgreSQL. It is already included in the distribution of PostgreSQL. You may want to check out this web site for a newer copy

Usage of pgaccess -
# man xhost
# xhost +
# su - postgres
bash$ man pgaccess
bash$ export DISPLAY=<hostname>:0.0
bash$ pgaccess mydatabase

Features of PgAccess

PgAccess windows - Main window, Table builder, Table(query) view, Visual query builder.

Tables

Queries

Sequences

Future implementation will have

INFORMATION ABOUT LIBGTCL

You will need the PostgreSQL to Tcl interface library libgtcl, lined as a Tcl/Tk 'load'-able module. The libpgtcl and the source is located in the PostgreSQL directory /src/interfaces/libpgtcl. Specifically, you will need a libpgtcl library that is 'load'-able from Tcl/Tk. This is technically different from an ordinary PostgreSQL loadable object file, because libpgtcl is a collection of object files. Under Linux, this is called libpgtcl.so. You can download from the above site a version already compiled for Linux i386 systems. Just copy libpgtcl.so into your system library director (/usr/lib). One of the solutions is to remove from the source the line containing load libpgtcl.so and to load pgaccess.tcl not with wish, but with pgwish (or wishpg) that wish that was linked with libpgtcl library.

If you get crypt not found during compilation pgaccess source tree then use -lcrypt.

15.2 GtkSQL Graphical Query Tool for PostgreSQL

GtkSQL is a graphical query tool (like PostgreSQL's psql). It is released under the GNU GPL license, and was developped using Gtk+ 1.2.3 and PostgreSQL 6.3. The main site of GtkSQL is at http://gtksql.sourceforge.net

Its main features are :

  1. multiple SQL buffers
  2. SQL keywords, table names and fields autocompletion
  3. easy displaying of table definition
  4. PostgreSQL and MySQL support (and easy addition of other databases)
The current version is GtkSQL v. 0.3. You can get the source from https://sourceforge.net/project/?form_grp=533

15.3 Windows Interactive Query Tool for PostgreSQL (WISQL or MPSQL)

MPSQL provides users with a graphical SQL interface to PostgresSQL. MPSQL is similar to Oracle's SQL Worksheet and Microsoft SQL Server's query tool WISQL. It has nice GUI and has history of commands. Also you can cut and paste and it has other nice features to improve your productivity.

15.4 Interactive Query Tool (ISQL) for PostgreSQL called PSQL

ISQL is for character command line terminals. This is included in the distribution, and is called "psql". Very similar to Sybase ISQL, Oracle SQLplus. At unix prompt give command 'psql' which will put you in psql> prompt.

bash# su - postgres
bash$ man psql
bash$ psql mydatabase
Type \h to see help of commands.
Very user friendly and easy to use. Can also be accessed from shell scripts.

15.5 MPMGR - A Database Management Tool for PostgresSQL

MPMGR will provide a graphical management interface for PostgresSQL. You can find it at

15.6 PgAdmin, PhpPgAdmin tools

15.7 PgBash - SQL shell tool

PgBash has functionality which is similar to psql. And, PgBash provides the useful functionality in making flexible interactive operational environment using bash alias, function, the history editing, etc.

The main site of PgBash is at http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html

PgBash is a shell which included the "direct SQL" or the "embedded SQL" interface for PostgreSQL by the improvement on the bash(current version 2.03) shell. PgBash can be used as a log-in shell, a sub-shell(the shell started from a shell) and a shell program use.

Here, "Direct SQL" shows functionality which immediately outputs the result to the "standard output". And "Embedding SQL" shows functionality which sets the retrieval result into the shell variable and which deals with in shell script language.

SQL statement(terminal character is a semicolon) is handled as one shell command, it is possible to execute the SQL statement with pipeline, redirection and background_job options. In addition, by using the exec_sql command, it is possible to execute SQL statement with the various options. The executive example of SQL is shown next.


prompt> /usr/local/bin/pgbash                .....Start of pgbash
pgbash> connect to db2@xxx.com user sakaida; .....connect to database
pgbash> select * from test limit 100; | more .....with pipeline
pgbash> select * from test; > /tmp/sel.dat & .....with redirect+background_Job
pgbash> addr='Osaka'
pgbash> insert into test values(             
>  111,'name',                               .....can start new line
> '$addr'                                    .....use shell variable
> );
pgbash> connect to db3@yyy.com user postgres;
pgbash> set connection db2;                  .....set current D/B to db2
pgbash> select * from test;                  .....select db2's test
pgbash> exec_sql -d db3 "select * from test3".....change connection to db3
pgbash> ls                                   
pgbash> begin;
pgbash> declare cur cursor for select * from test;
pgbash> fetch in cur into :AA,:BB;           .....set shell variables
pgbash> echo "AA=$AA, BB=$BB"
pgbash> end;
pgbash> fc fetch                             .....edit history and go
pgbash> !echo                                .....retry echo
pgbash> disconnect all                       .....disconnect all connections
pgbash> exit                                 .....End of pgbash

15.8 Webmin Tool for PostgreSQL

The webmin tool (administration of an Unix machine through a, secure if you want, webpage) has a PostgreSQL module as of the latest release (version 0.82). With this module you can add users, groups, databases, tables, view tables.

You can find webmin on http://www.webmin.com/webmin


Next Previous Contents