PostgreSQL Server Programming(Second Edition)
Usama Dar Hannu Krosing Jim Mlodgenski Kirk Roybal更新时间:2021-07-23 20:37:08
最新章节:Indexcoverpage
PostgreSQL Server Programming Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files eBooks discount offers and more
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Chapter 1. What Is a PostgreSQL Server?
Why program in the server?
About this book's code examples
Moving beyond simple functions
Managing related data with triggers
Auditing changes
Data cleaning
Custom sort orders
Programming best practices
Caching
Wrapping up – why program in the server?
Summary
Chapter 2. Server Programming Environments
Cost of acquisition
Availability of developers
Licensing
Predictability
Community
Procedural languages
Summary
Chapter 3. Your First PL/pgSQL Function
Why PL/pgSQL?
The structure of a PL/pgSQL function
Conditional expressions
Returning a record
Acting on the function's results
Summary
Chapter 4. Returning Structured Data
Sets and arrays
Returning sets
Using a set returning function
Functions based on views
OUT parameters and records
A summary of the RETURN SETOF variants
Returning cursors
Other ways to work with structured data
Summary
Chapter 5. PL/pgSQL Trigger Functions
Creating the trigger function
Working on a simple "Hey I'm called" trigger
The audit trigger
Disallowing DELETE
Disallowing TRUNCATE
Modifying the NEW record
The immutable fields trigger
Controlling when a trigger is called
Visibility
Variables passed to the PL/pgSQL TRIGGER function
Summary
Chapter 6. PostgreSQL Event Triggers
Use cases for creating event triggers
Creating event triggers
Creating an audit trail
Preventing schema changes
A roadmap of event triggers
Summary
Chapter 7. Debugging PL/pgSQL
Manual debugging with RAISE NOTICE
Visual debugging
Summary
Chapter 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
Chapter 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
Chapter 10. Scaling Your Database with PL/Proxy
Creating a simple single-server chat
Dealing with success – splitting tables over multiple databases
Connection Pooling
Summary
Chapter 11. PL/Perl – Perl Procedural Language
When to use PL/Perl
Installing PL/Perl
A simple PL/Perl function
Passing and returning non-scalar types
Writing PL/Perl triggers
Untrusted Perl
Summary
Chapter 12. PL/Tcl – Tcl Procedural Language
Installing PL/Tcl
A simple PL/Tcl function
Passing and returning arrays
Passing composite-type arguments
Accessing databases
Writing PL/Tcl triggers
Untrusted Tcl
Summary
Chapter 13. Publishing Your Code as PostgreSQL Extensions
When to create an extension
Unpackaged extensions
Extension versions
The .control file
Building an extension
Installing an extension
Viewing extensions
Publishing your extension
Installing an extension from PGXN
Summary
Chapter 14. PostgreSQL as an Extensible RDBMS
What can't be extended?
Creating a new operator
Creating index access methods
Creating user-defined aggregates
Using foreign data wrappers
Summary
Index
更新时间:2021-07-23 20:37:08