Summary

The main points you learned in this chapter are that you can return multiple rows and return data using OUT parameters, as well as return multiple rows of complex data, similar to a SELECT query. You also learned that several sets of tables can be returned, and you can possibly have them evaluated in a lazy manner using refcursors. Moreover, you can return data as complex as you want using either XML or JSON.

So, there really are very few reasons for not using database functions as your main interaction mechanism with the database. In the next chapter, we will learn how to call functions when different types of events occur in the database.

Get PostgreSQL Server Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.