LJ Archive

PostgreSQL: Introduction and Concepts

Stephanie Black

Issue #88, August 2001

PostgreSQL: Introduction and Concepts is an excellent introduction, not only to PostgreSQL in particular, but to databases in general.

It's hard to call oneself a fan of databases. Usually, one uses these kinds of applications out of sheer necessity, not because they're within an arm's reach of “exciting”. If databases themselves don't bore new users into out-of-mind experiences, the books that come with them usually do. Usually, the books assume knowledge users don't have, speak above/below the user's comprehension level or leave out all the useful pieces of information.

PostgreSQL: Introduction and Concepts (Addison-Wesley, 2000) is an excellent introduction, not only to PostgreSQL in particular, but to databases in general. It takes the novice database user through all the steps of the TEST database and does so without obfuscation or confusion. For the seasoned database designer/maintainer, it offers a wonderful reference to programming interfaces (including PHP, Embedded C and Python), pgsql commands and other features unique to PostgreSQL.

As of this writing, the book is in its second printing, having sold a massive 2,155 copies in the first month after its release last November. Given the increasing number of people making the transition to open-source software, and the number of people who need a good reference manual for database servers, the need for a book such as PostgreSQL is evident.

Momjian, a founding member of the PostgreSQL Global Development Team, has included a wide range of information on topics ranging from basic database setup to more senior administrative subjects, such as host/hostssl connections, backing up/restoring databases and internationalization. The average user will learn to run psql to access her/his database, enter data, view existing tables and make queries.

This is not, however, merely a glorified HOWTO: numerous features in PostgreSQL are useful to programmers, webmasters/mistresses, as well as DBAs. There are a fair number of programming interfaces for PostgreSQL, broadening its potential uses among computer professionals. This book certainly unlocks much of that potential in its discussion of the languages PostgreSQL can interface with, complete with sample programs illustrating the process.

The book is just as informative about what can be done with this database software as it is about how to do it. From this perspective, it is a success. It is not, however, perfect.

Some organization is present—a good thing to be sure in a book about databases. The trouble is, it's apparent that Momjian hasn't been around database newbies for a while. Were “Appendix B: Installation”, “Chapter 2: Issuing Database Commands” and the first portion of “Chapter 20: Administration” all put together, the new PostgrSQL user would have an easier time setting things up. As it is, one wanders around those three sections for a while, trying to get the hang of things. Momjian has included a fair amount of information about database setup and user creation in “Administration”, which makes sense if he assumes the user will be on a network that is administered by a seasoned DBA. It is inappropriate, however, for an individual who wants to create and maintain a database on a single-user system. Get ready for a lot of flipping back and forth if you fall into the latter category.

I believe every technical book should have three qualities: good indices, clear writing and wise use of appendices. Regrettably, Momjian has included appendices to the tune of 50% of the book, which tends to detract from his work and gives the reader a sense of the book being padded. Certainly an appendix with additional resources is moderately helpful, but a reader shouldn't need a FAQ listing for software that is on the Internet. Such information is best left on-line. The reference manual, included in Appendix D, is helpful but large enough (nearly 200 pages!) to warrant its own cover or reference (with its URL) as an additional resource in Appendix A.

That said, the remainder of the book is well thought out, and the content of chapters is in accord with their titles.

Technical Glitches

There are some commands that, according to the book, should work but don't. To be fair, this could be a discrepancy between the version used to test the book's commands and the version in current use. The most recent release is 7.0.3; testing of some of the commands was done with 6.5.3. (If you're using the 6.5.3 release, it would be best to update it; if you're involved in the release of a Linux distribution, you'll want to clamor for the inclusion of a more recent version of PostgreSQL.) When I tried CREATE USER I got:

sjb=> CREATE USER paa;
CREATE USER
sjb=> CREATE GROUP alteregos WITH USER sjb, paa;
ERROR: parser: parse error at or near "group"

Several variations of this were attempted with the same results. An associate attempted the same commands using the same release of the software, with the same results. Such situations are, alas, not addressed in the book.

NULL/NOT NULL values also represent problems with this version of the software, at least on the Red Hat 6.2 and Storm 2.0.6 systems that were used. While the author of the book isn't necessarily responsible for these errors, it would have been helpful if possible workarounds were included in the book. There is no recognition that PostgreSQL has its “moments”.

Conclusion

Aside from some relatively minor problems as mentioned above, PostgreSQL is a solid reference for constructing, manipulating and managing a database. As the software grows, so will its audience. As to whether it's worth the purchase price, one of the best things about this book is its availability on-line. If you are a PostgreSQL guru and need only an occasional reference, you might well forego purchasing the book and use the on-line version. Otherwise, it's a remarkably good investment.

Stephanie Black is a writer—of words and code. When not writing, she runs a Linux consultancy, Coastal Den Computing, in Vancouver, BC, Canada. In her off-hours, she's usually playing fetch with her cats or collaborating/colluding with her partner, a fabric artist and business manager.

LJ Archive