| Example of executing SQL in the interactive environment.
 
 
 
| prompt> /usr/local/bin/pgbash
 
 | 
Welcome to Pgbash ( bash-x.x.x ) Patch Ver.x rX.X
  Type '?'  for help with pgbash commands.
  Type 'exit' or 'Ctrl+D' to terminate Pgbash.
 | 
 pgbash> ?con pgbash:8408 db84
 
 | 
# PostgreSQL 8.4.8 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 
# CONNECT TO  pgbash:8408  AS  db84  USER  pgbash
# List of database connection (C: current database is '*')
+---+--------------+-----------+-----------------------------+-----------------+
| C | connect_name | user_name | target_name(db@server:port) | client_encoding |
+---+--------------+-----------+-----------------------------+-----------------+
| * | db84         | pgbash    | pgbash:8408                 |                 |
+---+--------------+-----------+-----------------------------+-----------------+
(1 row)
 | 
 pgbash> ?d
 
 | 
[ List of relations ]
 Schema | Name               | Type     | Owner
--------+--------------------+----------+----------
 public | countrylist        | table    | postgres
 public | pgbash_description | table    | pgbash
 public | test_inherit       | table    | pgbash
 public | test_inherit2      | table    | pgbash
 public | test_sequence      | sequence | pgbash
 public | test_table         | table    | pgbash
 public | test_table2        | table    | pgbash
 public | test_view          | view     | pgbash
(8 rows)
 | 
 pgbash> ?d test_table
 
 | 
[ Table "test_table" ]
 Column   | Type                  | NotNull  | Default
----------+-----------------------+----------+--------------------------
 code     | integer               | not null |
 name     | character varying(32) |          | 'aaa'::character varying
 address  | character varying(64) |          |
 dept_id  | character(4)          |          | '001'::bpchar
 jobid    | character(3)          | not null | '999'::bpchar
 inherits | test_table2           |          |
(6 rows)
Indexes
 test_table_pkey : CREATE UNIQUE INDEX test_table_pkey ON test_table USING btree (code)
 ix_jobid        : CREATE INDEX ix_jobid ON test_table USING btree (jobid)
Check constraints
 ch_code  : CHECK (code >= 1 AND code <= 9999)
 ch_jobid : CHECK (jobid >= 'aaaa'::bpchar AND jobid <= 'zzzz'::bpchar)
Foreign keys
 test_table_dept_id_fkey : FOREIGN KEY (dept_id) REFERENCES test_table_dept(dept_id)
 | 
 pgbash> insert into member(userid,name,zip,address1,tel,email) values(
 > 22, 'xxxxx11','611-2222','osaka','078-999-8888','youko@xxx.co.jp');
 INSERT  xxxxxxx
 pgbash> insert into member(userid,name,zip,address1,tel,email) values(
 > 23, 'aaaaa22','622-3333','osaka','078-888-7777','haru@aaa.co.jp');
 INSERT  xxxxxxx
 ..................
 
 pgbash> select userid,name,zip,address1,tel,email from member;
 
 | 
 userid | name     | zip      | address1 | tel          | email           
--------+----------+----------+----------+--------------+-----------------
     22 | xxxxx11  | 611-2222 | osaka    | 078-999-8888 | youko@xxx.co.jp 
     23 | aaaaa22  | 622-3333 | osaka    | 078-888-7777 | haru@aaa.co.jp  
     24 | bbbbb33  | 633-4444 | kobe-shi | 078-666-5555 | nobu@bbb.co.jp 
     25 | cccccc   | 644-5555 | kobe-shi | 06-1111-2222 | yumi@ccc.co.jp 
     26 | ddddd55  | 311-2222 | kobe-shi | 03-2222-3333 | miti@ddd.co.jp 
(5 rows)
 | 
 pgbash>  L+
 pgbash>  !select
 
 | 
+--------+----------+----------+----------+--------------+-----------------+
| userid | name     | zip      | address1 | tel          | email           |
+--------+----------+----------+----------+--------------+-----------------+
|     22 | xxxxx11  | 611-2222 | osaka    | 078-999-8888 | youko@xxx.co.jp |
|     23 | aaaaa22  | 622-3333 | osaka    | 078-888-7777 | haru@aaa.co.jp  | 
|     24 | bbbbb33  | 633-4444 | kobe-shi | 078-666-5555 | nobu@bbb.co.jp  | 
|     25 | cccccc   | 644-5555 | kobe-shi | 06-1111-2222 | yumi@ccc.co.jp  |
|     26 | ddddd55  | 311-2222 | kobe-shi | 03-2222-3333 | miti@ddd.co.jp  |
+--------+----------+----------+----------+--------------+-----------------+
(5 rows)
 | 
 pgbash> !!  | more
 
 | 
+--------+----------+----------+----------+--------------+-----------------+
| userid | name     | zip      | address1 | tel          | email           |
+--------+----------+----------+----------+--------------+-----------------+
|     22 | xxxxx11  | 611-2222 | osaka    | 078-999-8888 | youko@xxx.co.jp |
|     23 | aaaaa22  | 622-3333 | osaka    | 078-888-7777 | haru@aaa.co.jp  | 
|     24 | bbbbb33  | 633-4444 | kobe-shi | 078-666-5555 | nobu@bbb.co.jp  | 
|     25 | cccccc   | 644-5555 | kobe-shi | 06-1111-2222 | yumi@ccc.co.jp  |
|     26 | ddddd55  | 311-2222 | kobe-shi | 03-2222-3333 | miti@ddd.co.jp  |
+--------+----------+----------+----------+--------------+-----------------+
(5 rows)
 | 
 pgbash> select * from member ; &> /tmp/sel.dat &
 pgbash> cat /tmp/sel.dat
 
 | 
+--------+----------+----------+----------+--------------+-----------------+
| userid | name     | zip      | address1 | tel          | email           |
+--------+----------+----------+----------+--------------+-----------------+
|     22 | xxxxx11  | 611-2222 | osaka    | 078-999-8888 | youko@xxx.co.jp |
|     23 | aaaaa22  | 622-3333 | osaka    | 078-888-7777 | haru@aaa.co.jp  | 
|     24 | bbbbb33  | 633-4444 | kobe-shi | 078-666-5555 | nobu@bbb.co.jp  | 
|     25 | cccccc   | 644-5555 | kobe-shi | 06-1111-2222 | yumi@ccc.co.jp  |
|     26 | ddddd55  | 311-2222 | kobe-shi | 03-2222-3333 | miti@ddd.co.jp  |
+--------+----------+----------+----------+--------------+-----------------+
(5 rows)
 | 
 pgbash>  L-
 pgbash> select * from member_log_view;
 
 | 
stat| userid | name     | zip      | address1 | tel            | email
----+--------+----------+----------+----------+----------------+-----------------
    |   1265 | kitamina | 555-1111 | Toyonaka |                | tada@xxx.ne.jp
UP  |   1265 | kitamina | 555-1111 | Toyonaka | 6666-1111,090  | tada@xxx.ne.jp
    |   1252 | hota     | 666-1111 | Nisinomi | 0797-61-1749   | mun@xxxxx.com 
UP  |   1252 | hota     | 666-1111 | Nisinomi | 0797-61-1749   | mune@xxxxx.com
....................
 | 
 pgbash> disconnect all;
 pgbash> exit
 prompt>
 
 | 
 |