Download from Wow! eBook <www.wowebook.com>
PostgreSQL: Up and Running
Regina Obe and Leo Hsu
Beijing • Cambridge • Farnham • Kưln • Sebastopol • Tokyo
PostgreSQL: Up and Running
by Regina Obe and Leo Hsu
Copyright © 2012 Regina Obe and Leo Hsu. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
Editor: Meghan Blanchette
Production Editor: Iris Febres
Proofreader: Iris Febres
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Rebecca Demarest
Revision History for the First Edition:
2012-07-02
First release
See for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. PostgreSQL: Up and Running, the image of the elephant shrew, and related trade
dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
ISBN: 978-1-449-32633-3
[LSI]
1341247831
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1. The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Where to Get PostgreSQL
Notable PostgreSQL Forks
Administration Tools
What’s New in Latest Versions of PostgreSQL?
Why Upgrade?
What to Look for in PostgreSQL 9.2
PostgreSQL 9.1 Improvements
Database Drivers
Server and Database Objects
Where to Get Help
1
1
2
3
4
4
5
5
6
8
2. Database Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Configuration Files
The postgresql.conf File
The pg_hba.conf File
Reload the Configuration Files
Setting Up Groups and Login Roles (Users)
Creating an Account That Can Log In
Creating Group Roles
Roles Inheriting Rights
Databases and Management
Creating and Using a Template Database
Organizing Your Database Using Schemas
Permissions
Extensions and Contribs
Installing Extensions
Common Extensions
Backup
9
10
12
14
14
15
15
15
16
16
16
17
18
19
21
22
iii
About the Authors
Regina Obe is a co-principal of Paragon Corporation, a database consulting company
based in Boston. She has over 15 years of professional experience in various
programming languages and database systems, with special focus on spatial databases.
She is a member of the PostGIS steering committee and the PostGIS core development
team. Regina holds a BS degree in mechanical engineering from the Massachusetts
Institute of Technology. She co-authored PostGIS in Action.
Leo Hsu holds an MS degree in engineering of economic systems from Stanford Leo
Hsu is a co-principal of Paragon Corporation, a database consulting company based in
Boston. He has over 15 years of professional experience developing and thinking about
databases for organizations large and small. Leo holds an MS degree in engineering of
economic systems from Stanford University and BS degrees in mechanical engineering
and economics from the Massachusetts Institute of Technology. He co-authored
PostGIS in Action.
Download from Wow! eBook <www.wowebook.com>