A function can either return a single value of the specified type, or a whole result set (called SETOF). In order to return a single value, either a scalar or complex type, a RETURN statement is used. When the control flow reaches a RETURN, it immediately stops the function execution and provides the value to the caller.
It is possible to issue an empty RETURN, which is a statement that simply ends the control flow of the function without returning any particular value.
In order to see how RETURN can work with a scalar type, let's examine the code snipper of Listing 46. Here, the function accepts a single argument, f_size, which is supposed to be the size of a file (in bytes). The function compares the file ...