We now have covered the traditional ways of returning sets of structured data from functions. We will now start with the more interesting part. Other methods of passing around complex data structures have evolved in the world today.
In the real world, most of the data is not in a single table and the database is not the main thing that most programmers focus on. Often, they don't even think of it at all, or at least would rather not think about it.
If you are a database developer working on the database side of things, it is often desirable to talk to the clients (be it web or application developers as your client, or programs as database clients) in the language they speak. Currently, the two most widely spoken data languages by the web applications and their developers are XML and JSON.
Both XML and JSON are text-based data formats, and as such, they can be easily saved into fields of type text. PostgreSQL...