Documentation
 
 
 

18.2. Features

Table 18-1 lists the currently available EnterpriseDB PSQL features:

Table 18-1. EnterpriseDB PSQL Features

FeatureDescriptionExample(s)
Launch EnterpriseDB PSQL from the command line. Allow a user to launch EnterpriseDB PSQL and connect to a specific database by giving valid credentials, database name, username and password, as described below:
 
    edb-psql dbname userid password
    
edb-psql edb enterprisedb --Connect to the edb database as user enterprisedb
DESC or DESCRIBE for getting the definition of database objects. The EnterpriseDB PSQL DESCRIBE/DESC command returns the definitions of tables and views in a particular database. For example to view the definition of our sample "dept" table, you would do something as follows:
 edb=# DESCRIBE dept;
        Table "public.dept"
 Column |     Type     | Modifiers
--------+--------------+-----------
 deptno | numeric(2,0) | not null
 dname  | varchar2(14) |
 loc    | varchar2(13) |
Indexes:
    "dept_pk" PRIMARY KEY
    "dept_dname_uq" UNIQUE
edit Opens the last query in the editor.
edb=# select * from emp;
 empno | ename  |    job    | mgr  |      hiredate      |   sal   |  comm   | deptno
-------+--------+-----------+------+--------------------+---------+---------+--------
  7369 | SMITH  | CLERK     | 7902 | 17-DEC-80 00:00:00 |  800.00 |         |     20
  7499 | ALLEN  | SALESMAN  | 7698 | 20-FEB-81 00:00:00 | 1600.00 |  300.00 |     30
  7521 | WARD   | SALESMAN  | 7698 | 22-FEB-81 00:00:00 | 1250.00 |  500.00 |     30
  7566 | JONES  | MANAGER   | 7839 | 02-APR-81 00:00:00 | 2975.00 |         |     20
  7654 | MARTIN | SALESMAN  | 7698 | 28-SEP-81 00:00:00 | 1250.00 | 1400.00 |     30
  7698 | BLAKE  | MANAGER   | 7839 | 01-MAY-81 00:00:00 | 2850.00 |         |     30
  7782 | CLARK  | MANAGER   | 7839 | 09-JUN-81 00:00:00 | 2450.00 |         |     10
  7788 | SCOTT  | ANALYST   | 7566 | 19-APR-87 00:00:00 | 3000.00 |         |     20
  7839 | KING   | PRESIDENT |      | 17-NOV-81 00:00:00 | 5000.00 |         |     10
  7844 | TURNER | SALESMAN  | 7698 | 08-SEP-81 00:00:00 | 1500.00 |    0.00 |     30
  7876 | ADAMS  | CLERK     | 7788 | 23-MAY-87 00:00:00 | 1100.00 |         |     20
  7900 | JAMES  | CLERK     | 7698 | 03-DEC-81 00:00:00 |  950.00 |         |     30
  7902 | FORD   | ANALYST   | 7566 | 03-DEC-81 00:00:00 | 3000.00 |         |     20
  7934 | MILLER | CLERK     | 7782 | 23-JAN-82 00:00:00 | 1300.00 |         |     10
(14 rows)
edb=# edit
L or List for query listing Support for L command which enables listing last query in the buffer in EnterpriseDB PSQL. Suppose we run the following query, and then subsequently use L, it would list the last query as shown below:
edb=# SELECT empno, ename FROM emp
edb-# WHERE deptno = 10;
 empno | ename  
-------+--------
  7782 | CLARK  
  7839 | KING   
  7934 | MILLER 
(3 rows)
 
edb=# L
SELECT empno, ename FROM emp
WHERE deptno = 10;
R or Run for query listing and execution Support for R command in EnterpriseDB PSQL for listing and executing the last query in the buffer. Suppose we ran the following query previously in EnterpriseDB PSQL, then used R, it would re run the query as shown below:
SELECT empno, ename FROM emp
WHERE deptno = 10;
edb=# R

 empno | ename  
-------+--------
  7782 | CLARK  
  7839 | KING   
  7934 | MILLER 
(3 rows)
Save [filename] This command saves the last query in the specified filename. Suppose we ran the following query previously in EnterpriseDB PSQL, then used Save [filename], it would save the query in the specified filename as shown below:
edb=# SELECT * FROM emp;
 empno | ename  |    job    | mgr  |      hiredate      |   sal   |  comm   | deptno
-------+--------+-----------+------+--------------------+---------+---------+--------
  7369 | SMITH  | CLERK     | 7902 | 17-DEC-80 00:00:00 |  800.00 |         |     20
  7499 | ALLEN  | SALESMAN  | 7698 | 20-FEB-81 00:00:00 | 1600.00 |  300.00 |     30
  7521 | WARD   | SALESMAN  | 7698 | 22-FEB-81 00:00:00 | 1250.00 |  500.00 |     30
  7566 | JONES  | MANAGER   | 7839 | 02-APR-81 00:00:00 | 2975.00 |         |     20
  7654 | MARTIN | SALESMAN  | 7698 | 28-SEP-81 00:00:00 | 1250.00 | 1400.00 |     30
  7698 | BLAKE  | MANAGER   | 7839 | 01-MAY-81 00:00:00 | 2850.00 |         |     30
  7782 | CLARK  | MANAGER   | 7839 | 09-JUN-81 00:00:00 | 2450.00 |         |     10
  7788 | SCOTT  | ANALYST   | 7566 | 19-APR-87 00:00:00 | 3000.00 |         |     20
  7839 | KING   | PRESIDENT |      | 17-NOV-81 00:00:00 | 5000.00 |         |     10
  7844 | TURNER | SALESMAN  | 7698 | 08-SEP-81 00:00:00 | 1500.00 |    0.00 |     30
  7876 | ADAMS  | CLERK     | 7788 | 23-MAY-87 00:00:00 | 1100.00 |         |     20
  7900 | JAMES  | CLERK     | 7698 | 03-DEC-81 00:00:00 |  950.00 |         |     30
  7902 | FORD   | ANALYST   | 7566 | 03-DEC-81 00:00:00 | 3000.00 |         |     20
  7934 | MILLER | CLERK     | 7782 | 23-JAN-82 00:00:00 | 1300.00 |         |     10
(14 rows)

edb=# save "C:\SQL File.txt"
\set autocommit [on/off] Sets the autocommit on or off.
edb=# insert into test values (1);
INSERT 0 1
edb=# select * from test;
 i
---
 1
(1 row)

edb=# set autocommit on;
Spool [filename] This command logs all the command errors and the corresponding output to the specified file and shows the status of spooling. The use of this command is shown below:
edb=# Spool "C:\log.txt"
edb=# CREATE TABLE test(int i);
ERROR:  type "i" does not exist
edb=# CREATE TABLE test (i integer);
CREATE TABLE
Exit or Quit to terminate EnterpriseDB PSQL Allow the use of exit or quit command to terminate a EnterpriseDB PSQL session. The following example exists from EnterpriseDB PSQL and takes you back to your normal shell/command prompt.
 edb=# exit
[sarah@isb-sarah work]#
support for "rem[ark]" for comments. Whenever the statement beginning with REM or REMARK is encountered, EnterpriseDB PSQL treats all remaining characters on that line as comments. Hence using REM or REMARK will have the same effect as "--", a comment. The following query depicts this usage:
REM this statement fetches employees 
REM belonging to department 10
SELECT empno, ename FROM emp
WHERE deptno = 10;

 empno | ename  
-------+--------
  7782 | CLARK  
  7839 | KING   
  7934 | MILLER 
(3 rows)
\dA [ pattern ] Lists all available synonyms. If pattern is specified, only synonyms whose names match the pattern are shown. \dA

Please refer to edb-psql for further details on EnterpriseDB PSQL.

 
 ©2004-2007 EnterpriseDB All Rights Reserved