PostgreSQL Server
Programming
Extend PostgreSQL and integrate the database layer into
your development framework
Hannu Krosing
Jim Mlodgenski
Kirk Roybal
BIRMINGHAM - MUMBAI
PostgreSQL Server Programming
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly or
indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies
and products mentioned in this book by the appropriate use of capitals. However, Packt
Publishing cannot guarantee the accuracy of this information.
First published: June 2013
Production Reference: 1180613
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84951-698-3
www.packtpub.com
Cover Image by Hannu Krosing (hannu@2ndQuadrant.com)
Credits
Authors
Hannu Krosing
Jim Mlodgenski
Kirk Roybal
Reviewer
Gabriele Bartolini
Acquisition Editor
Sarah Cullington
Lead Technical Editor
Susmita Panda
Technical Editors
Veronica Fernandes
Vaibhav Pawar
Kirti Pujari
Amit Ramadas
Project Coordinator
Shraddha Vora
Proofreader
Joel T. Johnson
Indexer
Priya Subramani
Graphics
Ronak Dhruv
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
About the Authors
Hannu Krosing was a PostgreSQL user before it was rewritten to use SQL as its main
query language in 1995. So, he has both the historic perspective of its development and
almost 20 years of experience using it for solving various real-life problems.
Hannu was the rst Database Administrator and Database Architect at Skype, where he
invented the sharding language PL/Proxy that allows scaling the user database to work
with billions of users.
Since leaving Skype at the end of 2006—about a year after it was bought up by eBay—Hannu
has been working as a PostgreSQL consultant with 2ndQuadrant, the premier PostgreSQL
consultancy with global reach and local presence in most of the world.
Hannu has co-authored another Packt Publishing book, PostgreSQL 9 Administration
Cookbook, together with one of the main PostgreSQL developers, Simon Riggs.
I want to sincerely thank my wife Evelyn for her support while writing this
book.
Jim Mlodgenski is the CTO of OpenSCG, a professional services company focused on
leveraging open source technologies for strategic advantage. He was formerly the CEO of
StormDB, a database cloud company focused on horizontal scalability. Prior to StormDB, Jim
held deeply technical roles at Cirrus Technology, Inc., EnterpriseDB, and Fusion Technologies.
Jim is also a fervent advocate of PostgreSQL. He is a member of the board of the United
States PostgreSQL Association, as well as being a part of the organizing teams of the New
York PostgreSQL User Group and Philadelphia PostgreSQL User Groups.