PostgreSQL 7.2.1 Programmer's Guide

The PostgreSQL Global Development Group


Table of Contents
I. Client Interfaces
1. libpq - C Library
1.1. Introduction
1.2. Database Connection Functions
1.3. Command Execution Functions
1.4. Asynchronous Query Processing
1.5. The Fast-Path Interface
1.6. Asynchronous Notification
1.7. Functions Associated with the COPY Command
1.8. libpq Tracing Functions
1.9. libpq Control Functions
1.10. Environment Variables
1.11. Threading Behavior
1.12. Building Libpq Programs
1.13. Example Programs
2. Large Objects
2.1. Introduction
2.2. Implementation Features
2.3. Interfaces
2.4. Server-side Built-in Functions
2.5. Accessing Large Objects from Libpq
3. libpq++ - C++ Binding Library
3.1. Introduction
3.2. Control and Initialization
3.3. libpq++ Classes
3.4. Database Connection Functions
3.5. Query Execution Functions
3.6. Asynchronous Notification
3.7. Functions Associated with the COPY Command
4. pgtcl - Tcl Binding Library
4.1. Introduction
4.2. Loading pgtcl into your application
4.3. pgtcl Command Reference Information
5. libpgeasy - Simplified C Library
6. ecpg - Embedded SQL in C
6.1. Why Embedded SQL?
6.2. The Concept
6.3. How To Use ecpg
6.4. Limitations
6.5. Porting From Other RDBMS Packages
6.6. For the Developer
7. ODBC Interface
7.1. Introduction
7.2. Installation
7.3. Configuration Files
7.4. Windows Applications
7.5. ApplixWare
8. JDBC Interface
8.1. Setting up the JDBC Driver
8.2. Using the Driver
8.3. Issuing a Query and Processing the Result
8.4. Performing Updates
8.5. Creating and Modifying Database Objects
8.6. Storing Binary Data
8.7. PostgreSQL Extensions to the JDBC API
8.8. Using the driver in a multi-threaded or a servlet environment
8.9. Further Reading
9. PyGreSQL - Python Interface
9.1. The pg Module
9.2. pg Module Functions
9.3. Connection object: pgobject
9.4. Database wrapper class: DB
9.5. Query result object: pgqueryobject
9.6. Large Object: pglarge
9.7. DB-API Interface
II. Server Programming
10. Architecture
10.1. PostgreSQL Architectural Concepts
11. Extending SQL: An Overview
11.1. How Extensibility Works
11.2. The PostgreSQL Type System
11.3. About the PostgreSQL System Catalogs
12. Extending SQL: Functions
12.1. Introduction
12.2. Query Language (SQL) Functions
12.3. Procedural Language Functions
12.4. Internal Functions
12.5. C Language Functions
12.6. Function Overloading
12.7. Procedural Language Handlers
13. Extending SQL: Types
14. Extending SQL: Operators
14.1. Introduction
14.2. Example
14.3. Operator Optimization Information
15. Extending SQL: Aggregates
16. The Rule System
16.1. Introduction
16.2. What is a Query Tree?
16.3. Views and the Rule System
16.4. Rules on INSERT, UPDATE and DELETE
16.5. Rules and Permissions
16.6. Rules versus Triggers
17. Interfacing Extensions To Indexes
17.1. Introduction
17.2. Access Methods
17.3. Access Method Strategies
17.4. Access Method Support Routines
17.5. Operator Classes
17.6. Creating the Operators and Support Routines
18. Index Cost Estimation Functions
19. GiST Indexes
20. Triggers
20.1. Trigger Creation
20.2. Interaction with the Trigger Manager
20.3. Visibility of Data Changes
20.4. Examples
21. Server Programming Interface
21.1. Interface Functions
21.2. Interface Support Functions
21.3. Memory Management
21.4. Visibility of Data Changes
21.5. Examples
III. Procedural Languages
22. Procedural Languages
22.1. Introduction
22.2. Installing Procedural Languages
23. PL/pgSQL - SQL Procedural Language
23.1. Overview
23.2. Structure of PL/pgSQL
23.3. Declarations
23.4. Expressions
23.5. Basic Statements
23.6. Control Structures
23.7. Cursors
23.8. Errors and Messages
23.9. Trigger Procedures
23.10. Examples
23.11. Porting from Oracle PL/SQL
24. PL/Tcl - Tcl Procedural Language
24.1. Overview
24.2. Description
25. PL/Perl - Perl Procedural Language
25.1. Overview
25.2. Building and Installing PL/Perl
25.3. Description
26. PL/Python - Python Procedural Language
26.1. Introduction
26.2. Installation
26.3. Using PL/Python
List of Tables
4-1. pgtcl Commands
11-1. PostgreSQL System Catalogs
12-1. Equivalent C Types for Built-In PostgreSQL Types
17-1. Index Access Method Schema
17-2. B-tree Strategies
23-1. Single Quotes Escaping Chart
List of Figures
10-1. How a connection is established
11-1. The major PostgreSQL system catalogs
List of Examples
1-1. libpq Example Program 1
1-2. libpq Example Program 2
1-3. libpq Example Program 3
2-1. Large Objects with Libpq Example Program
4-1. pgtcl Example Program
8-1. Processing a Simple Query in JDCB
8-2. Simple Delete Example
8-3. Drop Table Example
8-4. Binary Data Examples
22-1. Manual Installation of PL/pgSQL
23-1. A PL/pgSQL Trigger Procedure Example
23-2. A Simple PL/pgSQL Function to Increment an Integer
23-3. A Simple PL/pgSQL Function to Concatenate Text
23-4. A PL/pgSQL Function on Composite Type
23-5. A Simple Function
23-6. A Function that Creates Another Function
23-7. A Procedure with a lot of String Manipulation and OUT Parameters