Why select * from function doesn't work when function has return type void??

From: "Francisco Figueiredo Jr(dot)" <fxjrlists(at)yahoo(dot)com(dot)br>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Why select * from function doesn't work when function has return type void??
Date: 2003-07-22 19:15:15
Message-ID: 3F1D8D43.5080907@yahoo.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nigel J. Andrews 2003-07-22 19:23:28 Re: suggestions to improve postgresql suitability for
Previous Message The Hermit Hacker 2003-07-22 19:05:46 Re: Criteria for contrib/ versus gborg?