Book description
Extend PostgreSQL using PostgreSQL server programming to create, test, debug, and optimize a range of user-defined functions in your favorite programming language
In Detail
This book will show you that PostgreSQL is so much more than a database server. In fact, it could even be seen as an application development framework, with the added bonuses of transaction support, massive data storage, journaling, recovery, and a host of other features that the PostgreSQL engine provides.
You will get to grips with creating libraries of useful code, grouping them into even more useful components, and distributing them to the community. Then, you will take a look at user-defined functions, and how to define and utilize them efficiently. You will also learn how to extract data from a multitude of foreign data sources and extend PostgreSQL to do it natively. What's more, you can do all of this in a nifty debugging interface that will allow you to do it efficiently and reliably. This book explores all possible ways to extend PostgreSQL and write server-side code using various programming languages with concrete and easy-to-understand examples.
What You Will Learn
- Write functions in the built-in PL/pgSQL language or your language of choice
- Define and use user-defined functions (UDF)
- Scale your data with PL/Proxy
- Extend PostgreSQL to overcome the limitations of classical SQL servers
- Debug using NOTIFY and using PL/pgSQL debugging extensions
- Discover the new features in PostgreSQL 9.4 such as event triggers and other improvements relevant to server-side programming
- Fully integrate the database layer into your development
Table of contents
-
PostgreSQL Server Programming Second Edition
- Table of Contents
- PostgreSQL Server Programming Second Edition
- Credits
- About the Authors
- About the Reviewers
- www.PacktPub.com
- Preface
- 1. What Is a PostgreSQL Server?
- 2. Server Programming Environments
- 3. Your First PL/pgSQL Function
- 4. Returning Structured Data
- 5. PL/pgSQL Trigger Functions
- 6. PostgreSQL Event Triggers
- 7. Debugging PL/pgSQL
-
8. Using Unrestricted Languages
- Are untrusted languages inferior to trusted ones?
- Can you use untrusted languages for important functions?
- Will untrusted languages corrupt the database?
- Why untrusted?
- Quick introduction to PL/Python
- Thinking out of the "SQL database server" box
- Summary
-
9. Writing Advanced Functions in C
- The simplest C function – return (a + b)
- Adding functionality to add(int, int)
- Basic guidelines for writing C code
- Error reporting from C functions
- Running queries and calling PostgreSQL functions
- Handling records as arguments or returned values
- Fast capturing of database changes
- Doing something at commit/rollback
- Synchronizing between backends
- Writing functions in C++
- Additional resources for C
- Summary
- 10. Scaling Your Database with PL/Proxy
- 11. PL/Perl – Perl Procedural Language
- 12. PL/Tcl – Tcl Procedural Language
- 13. Publishing Your Code as PostgreSQL Extensions
- 14. PostgreSQL as an Extensible RDBMS
- Index
Product information
- Title: PostgreSQL Server Programming - Second Edition
- Author(s):
- Release date: February 2015
- Publisher(s): Packt Publishing
- ISBN: 9781783980581
You might also like
book
PostgreSQL Development Essentials
Develop programmatic functions to create powerful database applications About This Book Write complex SQL queries and …
book
PostgreSQL 9 Administration Cookbook - Second Edition
Over 150 recipes to help you run an efficient PostgreSQL database in the cloud In Detail …
book
PostgreSQL 10 High Performance
Leverage the power of PostgreSQL 10 to design, administer and maintain a high-performance database solution About …
book
PostgreSQL 10 Administration Cookbook
A practical guide to administer, monitor and replicate your PostgreSQL 10 databaseAbout This Book Get to …