Hi all,


I would like to know why does calling a function with select * from function doesn't work when its return type is set to void.

I'm asking this because I have a code which uses this syntax to add support for returning resultsets from functions. This way, regardless the function returns a resultset or a single value, I could do select * from function and it works very well.

The problem appears when the function has its returns type to void.
I get the following error message:

npgsql_tests=> select * from funcF();
ERROR:  function funcf() in FROM has unsupported return type
ERROR:  function funcf() in FROM has unsupported return type


where funcF is defined as:


npgsql_tests=> create function funcF() returns void as 'delete from tablea where field_serial > 5' language 'sql';

CREATE FUNCTION

But it does work if I call it as:

select funcF();



I'd like to know if would be possible to change this behaviour to return an empty result set with a null value. This way, there would be consistency in calling all functions regardless of its return type with select * from function.

Thanks in advance.

--
Regards,

Francisco Figueiredo Jr.

------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi


---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to