Subject | Procedures vs functions |
---|---|
Author | Dmitry Yemanov |
Post date | 2006-03-19T08:47:42Z |
All,
We have some conflict with the standard. It declares procedures and
functions as sharing the same namespace, so you cannot have both procedure
TEST and function TEST. This allows some benefits:
1) select * from table (MY_FUNC); -- function returns a cursor
2) call MY_FUNC; -- we ignore result of a function
But our functions have a separate namespace. Currently, this is not an
issue, as parsing contexts of procedures and functions are different and not
ambiguous. But we could have issues with future extentions (see above for
example).
What's our position on this? Do we consider our functions (including PSQL
and Java ones) to always return a scalar result and offer procedures for
other tasks? Or would we like to become standard compliant in this aspect?
If so, how are we going to provide backward compatibility for databases
already containing procedures and functions with the same name?
Dmitry
We have some conflict with the standard. It declares procedures and
functions as sharing the same namespace, so you cannot have both procedure
TEST and function TEST. This allows some benefits:
1) select * from table (MY_FUNC); -- function returns a cursor
2) call MY_FUNC; -- we ignore result of a function
But our functions have a separate namespace. Currently, this is not an
issue, as parsing contexts of procedures and functions are different and not
ambiguous. But we could have issues with future extentions (see above for
example).
What's our position on this? Do we consider our functions (including PSQL
and Java ones) to always return a scalar result and offer procedures for
other tasks? Or would we like to become standard compliant in this aspect?
If so, how are we going to provide backward compatibility for databases
already containing procedures and functions with the same name?
Dmitry