Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
PostgreSQL Server Programming - Second Edition
PostgreSQL Server Programming - Second Edition

PostgreSQL Server Programming - Second Edition: Extend PostgreSQL using PostgreSQL server programming to create, test, debug, and optimize a range of user-defined functions in your favorite programming language , Second Edition

Arrow left icon
Profile Icon Dar Profile Icon Krosing Profile Icon Jim Mlodgenski
Arrow right icon
$22.99 $32.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (8 Ratings)
eBook Feb 2015 320 pages 2nd Edition
eBook
$22.99 $32.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Dar Profile Icon Krosing Profile Icon Jim Mlodgenski
Arrow right icon
$22.99 $32.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (8 Ratings)
eBook Feb 2015 320 pages 2nd Edition
eBook
$22.99 $32.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$22.99 $32.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

PostgreSQL Server Programming - Second Edition

Chapter 2. Server Programming Environments

You've had a chance to get acquainted with the general idea of using PostgreSQL, but now we are going to answer the question of why anyone will choose PostgreSQL as a development platform. As much as I'd like to believe that it's an easy decision for everyone, it's not.

For starters, let's get rid of the optimistic idea that you choose a database platform for technical reasons. Sure, we all like to think that we are objective, and we base our decisions on a preponderance of the technical evidence. This preponderance of evidence then indicates which features are available and relevant to our application. We will then proceed to make a weighted choice in favor of the most advantageous platform, and use a balance of the evidences to create workarounds and alternatives where our choice falls short. The fact is that we don't really understand all the requirements of the application until we are halfway through...

Cost of acquisition

One of biggest the factors that decides which technology is used in the application stack is the cost of acquisition. I've seen many application architectures drawn on a whiteboard where the technical team was embarrassed to show them, but they justified the design by trying to keep software licensing costs down. When it comes to the database environment, the usual suspects are Oracle, SQL Server, MySQL, and PostgreSQL. Oracle, the dominant player in the database space, is also the most costly. At the low end, Oracle does have reasonably priced offerings and even a free Express Edition, but they are limited. Most people have needs beyond the low-priced offerings and fall into the enterprise sales machine of Oracle. This usually results in a high-price quote that makes your CFO fall out of his/her chair, and you're back to designing your solution in order to keep your licensing costs down.

Then comes Microsoft SQL Server. This is your first reasonably viable...

Availability of developers

This has been one of the most hilarious parts of my development life. I recently recommended a local company to use PostgreSQL for a reporting system. The company in question wanted to know that if they chose PostgreSQL, would anyone on staff be able to maintain it. So, I began to interview the developers to find out about their experiences with PostgreSQL.

Me: Do you have any experience with PostgreSQL?

Developer 1: Yes, I used it at the last job for a product fulfillment project, but I don't think many people have that experience. We should probably stick to using MySQL.

Me: Do you have any experience with PostgreSQL?

Developer 2: Yes, I used it at the last job for a reporting project, but I don't think many people have that experience. We should probably stick to using MySQL.

After interviewing all seven developers that were influential on the project, I found that the only person without hands-on experience with PostgreSQL was the project manager. Since...

Licensing

About 2 months after Oracle bought MySQL, they announced a plan that divided the development into two camps: a MySQL community edition and a professional version. The community edition would no longer gain any new features, and the professional version would become a commercial product.

There was a vast and thunderous sucking sound in the open source community, as they thrashed wildly about to find a new platform for Free and Open Source Software (FOSS) development.

Oracle immediately (in about 2 weeks) countermanded the order and declared that things will stay as they were for the indefinite future. Those with short memories, forgiving hearts, or who just weren't paying attention went on about their business. Many other open source projects either switched to PostgreSQL or suddenly grew PostgreSQL database support.

Today, we have MySQL and MySQL Enterprise Edition. If you want backup, high availability, enterprise scalability, and the MySQL Enterprise Monitor, you now have...

Predictability

This section could just as well have been titled standards compliance, but I decided against it because the benefits of standards compliance in corporate projects are not obvious. The limitations of the common databases are well-documented, and I will show you a few websites in a moment where you can make a comparison of who has the most unintended behavior. I will encourage you to read the following material while thinking about the question, "Which method of feature development is most likely to make my application break in the future?":

Note

Spoiler alert:

A stricter adherence to standards comes at the cost of not allowing ambiguous behavior. Not allowing ambiguous behavior makes the developer's life more difficult. Making the developer's life more difficult ensures that the interpretation of the commands that the developer gives will not change later, breaking...

Community

Oracle and SQL Server don't have a community. Please understand when I say that, I mean that the chance that you will get to talk to a developer of the core database is about the same as your chance of winning the lottery. By the time you do, it's probably because you found a bug so heinous that it couldn't be ignored and the only person who can understand your report is the guy who wrote the code in question. They have paid technical support and this support has proven in my experience to be generally competent, but not stellar. I have had to work around the problem that I originally requested help with about 40 percent of the time.

Compare this to MySQL and PostgreSQL, where just about anybody can speak to just about anybody else all day long. Many of the core developers of both the platforms can be found on IRC, met at conventions, contacted for contract development work, and for the most part, bribed remarkably easily with beer (hint, hint, wink, wink, nudge...

Cost of acquisition


One of biggest the factors that decides which technology is used in the application stack is the cost of acquisition. I've seen many application architectures drawn on a whiteboard where the technical team was embarrassed to show them, but they justified the design by trying to keep software licensing costs down. When it comes to the database environment, the usual suspects are Oracle, SQL Server, MySQL, and PostgreSQL. Oracle, the dominant player in the database space, is also the most costly. At the low end, Oracle does have reasonably priced offerings and even a free Express Edition, but they are limited. Most people have needs beyond the low-priced offerings and fall into the enterprise sales machine of Oracle. This usually results in a high-price quote that makes your CFO fall out of his/her chair, and you're back to designing your solution in order to keep your licensing costs down.

Then comes Microsoft SQL Server. This is your first reasonably viable option. The...

Availability of developers


This has been one of the most hilarious parts of my development life. I recently recommended a local company to use PostgreSQL for a reporting system. The company in question wanted to know that if they chose PostgreSQL, would anyone on staff be able to maintain it. So, I began to interview the developers to find out about their experiences with PostgreSQL.

Me: Do you have any experience with PostgreSQL?

Developer 1: Yes, I used it at the last job for a product fulfillment project, but I don't think many people have that experience. We should probably stick to using MySQL.

Me: Do you have any experience with PostgreSQL?

Developer 2: Yes, I used it at the last job for a reporting project, but I don't think many people have that experience. We should probably stick to using MySQL.

After interviewing all seven developers that were influential on the project, I found that the only person without hands-on experience with PostgreSQL was the project manager. Since the project...

Left arrow icon Right arrow icon

Description

This book is for moderate to advanced PostgreSQL database professionals who wish to extend PostgreSQL, utilizing the most updated features of PostgreSQL 9.4. For a better understanding of this book, familiarity with writing SQL, a basic idea of query tuning, and some coding experience in your preferred language is expected.

Who is this book for?

This book is for moderate to advanced PostgreSQL database professionals who wish to extend PostgreSQL, utilizing the most updated features of PostgreSQL 9.4. For a better understanding of this book, familiarity with writing SQL, a basic idea of query tuning, and some coding experience in your preferred language is expected.

What you will learn

  • Write functions in the builtin PL/pgSQL language or your language of choice
  • Define and use userdefined 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 serverside programming
  • Fully integrate the database layer into your development

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 26, 2015
Length: 320 pages
Edition : 2nd
Language : English
ISBN-13 : 9781783980598
Vendor :
PostgreSQL Global Development Group
Category :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 26, 2015
Length: 320 pages
Edition : 2nd
Language : English
ISBN-13 : 9781783980598
Vendor :
PostgreSQL Global Development Group
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 175.97
PostgreSQL for Data Architects
$54.99
PostgreSQL Server Programming - Second Edition
$54.99
PostgreSQL 9 Administration Cookbook - Second Edition
$65.99
Total $ 175.97 Stars icon

Table of Contents

15 Chapters
1. What Is a PostgreSQL Server? Chevron down icon Chevron up icon
2. Server Programming Environments Chevron down icon Chevron up icon
3. Your First PL/pgSQL Function Chevron down icon Chevron up icon
4. Returning Structured Data Chevron down icon Chevron up icon
5. PL/pgSQL Trigger Functions Chevron down icon Chevron up icon
6. PostgreSQL Event Triggers Chevron down icon Chevron up icon
7. Debugging PL/pgSQL Chevron down icon Chevron up icon
8. Using Unrestricted Languages Chevron down icon Chevron up icon
9. Writing Advanced Functions in C Chevron down icon Chevron up icon
10. Scaling Your Database with PL/Proxy Chevron down icon Chevron up icon
11. PL/Perl – Perl Procedural Language Chevron down icon Chevron up icon
12. PL/Tcl – Tcl Procedural Language Chevron down icon Chevron up icon
13. Publishing Your Code as PostgreSQL Extensions Chevron down icon Chevron up icon
14. PostgreSQL as an Extensible RDBMS Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(8 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




CP Jun 08, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is an excellent book for anyone looking to explore PostgreSQL with an Oracle background. PostgreSQL, like Oracle, supports robust database programming. If you are a PL/SQL developer and are looking to explore what PostgreSQL has to offer for a developer, this is the book for you. There aren't too many books available for PostgreSQL programming, but this book does a great job exploring most of the avenues of PostgreSQL programming. The major difference between Oracle and PostgreSQL is the variety of languages available to program, which include Python and PostgreSQL's version of PL/SQL - PLpgSQL.This book is also written in a way that should be understandable to most programmers that haven't programmed in the database before. It covers a wide range of topics, including installing and setting up pgAdminIII and debugging your server-side programs.
Amazon Verified review Amazon
WiltDurkey Oct 06, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Well, first what do I mean by server-side? Mostly, anything that is not just admin work that is carried out through execution on the server, rather than by standard insert/update/delete/select SQL. It also does not include DDL.Which leaves you mostly with triggers and stored procedures, as well as some other things like sharding.Why do you care? Could you not find this info on the internet?Well, yes, you could. You could also spend hours tracking it down, between the different versions of postgres as well as reading posts by people who sometimes have a shaky grasp of how postgres operates. Basically, there is a lot of dross out there. And postgres is different, and sometimes more sophisticated than Oracle or SQL Server's procedural languages.In any case, while I could find a few tidbits with examples here and there, nothing was comprehensive. The bulk of reliable info is really on the postgres docs themselves. Which are good, but intended as a reference, not an introduction to its subject.On the other hand, I was able to quickly read this book, get a general idea of what postgres was capable of doing, and put that right into practice replacing some complicated and slow client-side SELECTs with a much tighter, faster and easier to understand and test postgres stored procedure.That's because this book is both good at explaining, written by someone who really knows his subject and covers most of the basic knowledge you need to get started.As a bonus, I was also able to quickly grasp what is meant by Python-based stored procedures. Not sure I have much use for them, despite using Python extensively on the client side, but now I know where to go if I need to.
Amazon Verified review Amazon
Alessandro Rossi Nov 22, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Libro scritto bene ed in maniera chiara,ci sono ottimi esempi che aiutano a capire ODBMS Postrgresql. Avendo già lavorato con Oracle è stato un utile introduzione che mi ha permesso di capire le differenze ed essere autosufficiente in breve tempo. A mio avviso consigliato anche per chi ha poche conoscenze di DB.
Amazon Verified review Amazon
KingDragonfly Aug 08, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As a DBA for many years, I don't agree with everything. For example while valid, I hate triggers because they can become extremely painful and confusing when things needs to be fixed. Also he makes a valid point about server-side versus client-side processing, however it's a little dated; the trend is to write horribly slow abstracted client side database processing, and throw more cloud based hardware at it when it performs badly. Love it or hate it: it's the Enterprise reality. My only complaint is audience is oriented to small shops / small businesses / simple clients.
Amazon Verified review Amazon
KS Jun 26, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
PostgreSQL のユーザ定義関数を種々の言語で書くためのレシピ集といったところでしょうか。正式なドキュメントやネット上のノウハウの隙間を埋めてくれるような内容で、助かります。C 言語の書き方はいろいろとノウハウがあるのですが、書ききれない部分もありました。特に、PostgreSQL コア機能を使うためのノウハウなどがあるといいのですが、SPIの簡単な記述があるだけだったのが残念。
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.