Why select * from function doesn't work when function has return type void?? - Mailing list pgsql-hackers

From Francisco Figueiredo Jr.
Subject Why select * from function doesn't work when function has return type void??
Date
Msg-id 3F1D8D43.5080907@yahoo.com.br
Whole thread Raw
Responses Re: Why select * from function doesn't work when function  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: Criteria for contrib/ versus gborg?
Next
From: "Nigel J. Andrews"
Date:
Subject: Re: suggestions to improve postgresql suitability for