Subject Re: Procedures vs functions
Author paulruizendaal
Dmitry,

Related to the namespace issue is a deeper thing, imho.

In my opinion cursors should be a "first class" datatype. It should
be possible to store cursors in variables and to pass cursors as
parameters between procedures and functions. And yes, cursors should
be a valid return type from a function.

I would aim for a unification of functions and procedures, with PSQL
procedures being generalized into (possibly void) functions. We could
keep the current PSQL procedure syntax with the following extensions:
- selectable procedures with one return value can be used in
expressions as functions
- if a udf and a procedure have the same name, the udf is used
- SUSPEND can take a cursor as optional argument; if it has such an
argument it will automatically loop, returning cursor rows one by one

Not sure how to best handle concepts like REF cursors, and cursors
created from collections.

Paul