Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Overview of this book

Table of Contents (19 chapters)
PostgreSQL 9 Administration Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Writing a script that either succeeds entirely or fails entirely


Database administration often involves applying a coordinated set of changes to the database. One of PostgreSQL's great strengths is the transaction system, wherein almost all actions can be executed inside a transaction. This allows us to build a script with many actions that will either all succeed or all fail. This means that if any of these actions fail, then all the other actions in the script are rolled back and never become visible to any other user, which can be critically important on a production system. This property is referred to as "atomicity" in the sense that the script is intended as a single unit that cannot be split, and this is the meaning of the "A" in the "ACID" properties of database transactions.

Transactions definitely apply to Data Definition Language (DDL), which refers to the set of SQL commands used to define, modify, and delete database objects. The term "DDL" goes back many years, but it persists...