PostgreSQL 7.3 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. pgtcl - Tcl Binding Library
3.1. Introduction
3.2. Loading pgtcl into your application
3.3. pgtcl Command Reference Information
4. libpgeasy - Simplified C Library
5. ecpg - Embedded SQL in C
5.1. Why Embedded SQL?
5.2. The Concept
5.3. How To Use ecpg
5.4. Limitations
5.5. Porting From Other RDBMS Packages
5.6. For the Developer
6. ODBC Interface
6.1. Introduction
6.2. Installation
6.3. Configuration Files
6.4. Windows Applications
6.5. ApplixWare
7. JDBC Interface
7.1. Setting up the JDBC Driver
7.2. Using the Driver
7.3. Issuing a Query and Processing the Result
7.4. Performing Updates
7.5. Creating and Modifying Database Objects
7.6. Storing Binary Data
7.7. PostgreSQL Extensions to the JDBC API
7.8. Using the driver in a multithreaded or a servlet environment
7.9. Further Reading
8. PyGreSQL - Python Interface
8.1. The pg Module
8.2. pg Module Functions
8.3. Connection object: pgobject
8.4. Database wrapper class: DB
8.5. Query result object: pgqueryobject
8.6. Large Object: pglarge
8.7. DB-API Interface
II. Server Programming
9. Architecture
9.1. PostgreSQL Architectural Concepts
10. Extending SQL: An Overview
10.1. How Extensibility Works
10.2. The PostgreSQL Type System
10.3. About the PostgreSQL System Catalogs
11. Extending SQL: Functions
11.1. Introduction
11.2. Query Language (SQL) Functions
11.3. Procedural Language Functions
11.4. Internal Functions
11.5. C Language Functions
11.6. Function Overloading
11.7. Table Functions
11.8. Procedural Language Handlers
12. Extending SQL: Types
13. Extending SQL: Operators
13.1. Introduction
13.2. Example
13.3. Operator Optimization Information
14. Extending SQL: Aggregates
15. The Rule System
15.1. Introduction
15.2. What is a Query Tree?
15.3. Views and the Rule System
15.4. Rules on INSERT, UPDATE and DELETE
15.5. Rules and Permissions
15.6. Rules versus Triggers
16. Interfacing Extensions To Indexes
16.1. Introduction
16.2. Access Methods and Operator Classes
16.3. Access Method Strategies
16.4. Access Method Support Routines
16.5. Creating the Operators and Support Routines
16.6. Creating the Operator Class
16.7. Special Features of Operator Classes
17. Index Cost Estimation Functions
18. GiST Indexes
19. Triggers
19.1. Trigger Definition
19.2. Interaction with the Trigger Manager
19.3. Visibility of Data Changes
19.4. Examples
20. Server Programming Interface
20.1. Interface Functions
20.2. Interface Support Functions
20.3. Memory Management
20.4. Visibility of Data Changes
20.5. Examples
III. Procedural Languages
21. Procedural Languages
21.1. Introduction
21.2. Installing Procedural Languages
22. PL/pgSQL - SQL Procedural Language
22.1. Overview
22.2. Structure of PL/pgSQL
22.3. Declarations
22.4. Expressions
22.5. Basic Statements
22.6. Control Structures
22.7. Cursors
22.8. Errors and Messages
22.9. Trigger Procedures
22.10. Examples
22.11. Porting from Oracle PL/SQL
23. PL/Tcl - Tcl Procedural Language
23.1. Overview
23.2. Description
24. PL/Perl - Perl Procedural Language
24.1. Overview
24.2. Building and Installing PL/Perl
24.3. Description
25. PL/Python - Python Procedural Language
25.1. Introduction
25.2. Installation
25.3. Using PL/Python
List of Tables
3-1. pgtcl Commands
10-1. PostgreSQL System Catalogs
11-1. Equivalent C Types for Built-In PostgreSQL Types
16-1. B-tree Strategies
16-2. Hash Strategies
16-3. R-tree Strategies
16-4. B-tree Support Functions
16-5. Hash Support Functions
16-6. R-tree Support Functions
16-7. GiST Support Functions
22-1. Single Quotes Escaping Chart
List of Figures
9-1. How a connection is established
10-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
3-1. pgtcl Example Program
7-1. Processing a Simple Query in JDCB
7-2. Simple Delete Example
7-3. Drop Table Example
7-4. Binary Data Examples
21-1. Manual Installation of PL/pgSQL
22-1. A PL/pgSQL Trigger Procedure Example
22-2. A Simple PL/pgSQL Function to Increment an Integer
22-3. A Simple PL/pgSQL Function to Concatenate Text
22-4. A PL/pgSQL Function on Composite Type
22-5. A Simple Function
22-6. A Function that Creates Another Function
22-7. A Procedure with a lot of String Manipulation and OUT Parameters