This book is for anyone interested in utilizing the PostgreSQL object-relational database-management system (ORDBMS). The reader should be familiar with Linux- and Unix-based systems, but is not expected to be a database guru. Although the test operating system for this book is Red Hat Linux, the tasks in this book that apply to Linux should apply to most Unix variants without much modification.
Structure of This Book
This book is divided into four parts, each focused on a different aspect of a PostgreSQL database system. It also includes a complete command reference, and a small set of technical appendixes.
, is a general overview of PostgreSQL. It documents what it is, where you can obtain it, and how to install it on your system. It also covers a wide variety of compilation options which allow you to customize PostgreSQL to your needs.
, delves deeper into the use of SQL, covering how to perform essential database functions such as creating and altering tables, inserting rows into tables, copying data, retrieving result sets, and using views.
, which details the more advanced PostgreSQL features such as indices, inheritance, arrays, constraints, triggers, sequences and cursors. This chapter also documents PostgreSQLs advanced extensibility with user-defined operators and functions.
documents how to add and remove user accounts and groups, and manage database privileges.
wraps up the part by documenting the installation, configuration and use of the LXP PostgreSQL application server for the Apache HTTP server.
Finally, contains a comprehensive command reference guide, which documents each of the standard and extended SQL commands supported by PostgreSQL.
Platform and Version Used
At the time of this books writing, version 7.1.3 is the most current release of PostgreSQL. This is the version used in all examples, and for the construction of our example database, booktown
. All examples should be compatible with any of the PostgreSQL 7.1 versions, which is the reason you will see the version referred to as 7.1.x within our text.
What Is Included on the CD?
The CD included with this book contains the complete source for PostgreSQL 7.1.3. The CD also includes the PostgreSQL application server LXP. The following is a listing of what is on the CD, including a short description of each package:
postgresql-7.1.3.tar.gzThe community version of PostgreSQL in compressed source form. This is the most actively developed PostgreSQL distribution. We do not provide binaries of PostgreSQL, as you may want to compile different features.
The source is available as a single compressed file ( postgresql-7.1.3.tar.gz ). Its contents are not extracted on the CD, as you must copy and extract the files onto your hard drive before installing PostgreSQL.
lxp-eval-0.8.0.tgzAn evaluation/developer-use copy of the LXP PostgreSQL application server for Apache 1.3.x. LXP is a good tool for integrating PostgreSQL (and other technologies) with the web. This package is a binary distribution intended for x86-based systems. It must be copied to your hard drive before it can be extracted.
lxp/A directory containing the extracted contents of the lxp-eval-0.8.0.tgz file. LXP can be installed directly from the lxp directory on the CD. See for information on installing LXP.
booktown.sqlThe PostgreSQL dump of the example booktown database used throughout this book. This file contains both commands to re-create the database schema, as well as some sample data.
To install this database after you have installed PostgreSQL, type from the command line psql -U postgres template1 -f /mnt/cdrom/booktown.sql (where /mnt/cdrom is the path to your mounted CD, and postgres is your PostgreSQL superuser).
Conventions Used in This Book
ItalicUsed for filenames, directory names, string-bound constants, and URLs. It is also used for emphasis, and for the first use of a technical term.
Constant width
Used for keywords, identifiers (such as tables and columns), data types, examples, and to show the contents of files, and the output of commands.
Constant width italic
Used in syntax descriptions to indicated user-defined items.
Constant width bold
Indicates user input within examples.
UPPERCASE
Used within syntax descriptions, uppercase usually indicates keywords.
lowercase
Used within syntax descriptions, lowercase usually indicates user-defined items, such as variables and identifiers.
[ ]
Used within syntax descriptions, square brackets enclose optional items, which are separated from one another by pipes (|
).
{ }
Used within syntax descriptions, curly brackets enclose a set of items from which you must choose one.
...
Used within syntax descriptions, ellipses indicate repeating information. Used within examples, ellipses indicate that a section of unimportant information was removed from the example output to improve readability and conserve space.
Note
The owl icon indicates a tip, suggestion, or general note. For example, well let you know that PostgreSQL supports the use of all ISO standard time zone abbreviations in the section on time zones.
Note
The turkey icon indicates a warning or caution. For example, well warn you ahead of time that using the