OUT parameters and records

Using a pre-existing type, table, or view for compound return types is a simple mechanism for returning more complex structures. However, there is often a need to define the return type of the function with the function itself and not depend on other objects. This is especially true when managing changes to a running application; so, over a period of time, two better ways to handle this have been added to PostgreSQL.

OUT parameters

Until now, all the functions we created used parameters that are defined as IN parameters. The IN parameters are meant to just pass information into the function that can be used, but not returned. Parameters can also be defined as OUT or INOUT parameters if you want the function to return some ...

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.