Book Image

PostgreSQL 11 Server Side Programming Quick Start Guide

By : Luca Ferrari
Book Image

PostgreSQL 11 Server Side Programming Quick Start Guide

By: Luca Ferrari

Overview of this book

PostgreSQL is a rock-solid, scalable, and safe enterprise-level relational database. With a broad range of features and stability, it is ever increasing in popularity.This book shows you how to take advantage of PostgreSQL 11 features for server-side programming. Server-side programming enables strong data encapsulation and coherence. The book begins with the importance of server-side programming and explains the risks of leaving all the checks outside the database. To build your capabilities further, you will learn how to write stored procedures, both functions and the new PostgreSQL 11 procedures, and create triggers to perform encapsulation and maintain data consistency. You will also learn how to produce extensions, the easiest way to package your programs for easy and solid deployment on different PostgreSQL installations.
Table of Contents (12 chapters)

What this book covers

This book aims to teach the reader how powerful server-side programming can be in PostgreSQL. At the same time, we are going to learn how fun can it be to implement even complex tasks directly in the database engine. This book is structured as follows:

Chapter 1, PostgreSQL Server-side Programming, presents the idea behind server-side programming and the relationship with PostgreSQL.

Chapter 2, Statement Tricks: UPSERTs, RETURNING, and CTEs, explains some of the powerful features of handling SQL statements that are supported by PostgreSQL, such as obtaining automatically computed data, resolving insert conflicts, and performing looping and joins.

Chapter 3, The PL/pgSQL Language, discusses the default language that can be used to implement code in PostgreSQL. This is an imperative, SQL-like language.

Chapter 4, Stored Procedures, teaches you how to store pieces of code in the server in order to execute them and re-use them later.

Chapter 5, PL/Perl and PL/Java, provides insights into how to use Perl and Java within the PostgreSQL server to implement stored procedures and run code.

Chapter 6, Triggers, explains how to run code that can react to data change events and data definition change events.

Chapter 7, Rules and the Query Rewriting System, explains how PostgreSQL can be used to transform statements into other forms.

Chapter 8, Extensions, teaches you how to organize your code in a way that PostgreSQL can handle and manage, as well as how to deal with updates.

Chapter 9, Intra-Process Communication and Background Workers, looks at how to interact with processes (database connections) and how to plug your own processes into the server.

Chapter 10, Custom Data Types, shows how it is possible to extend the already rich PostgreSQL data type to implement your own type with specific business logic.