Unknown kind of return type specified for function

Started by Avi Schwartzalmost 23 years ago4 messagesgeneral
Jump to latest
#1Avi Schwartz
avi@CFFtechnologies.com

I am creating a function that does not return anything so I am trying
the following:

create or replace function splite_delete_configured_selection(int, int,
int, int)
returns void
security definer
as '
declare
...
begin
...
return;
end;
' language 'plpgsql';

but as soon as I try to call this function I get the following error:

ERROR: Unknown kind of return type specified for function
splite_delete_configured_selection

How do I declare the fact that the function will return nothing?

I am running version 7.3.2.

Thanks.

Avi

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Avi Schwartz (#1)
Re: Unknown kind of return type specified for function

Avi Schwartz <avi@CFFtechnologies.com> writes:

How do I declare the fact that the function will return nothing?

"returns void" works fine for me.

regression=# create or replace function splite_delete_configured_selection(int,
regression(# int, int, int)
regression-# returns void
regression-# as '
regression'# begin
regression'# return;
regression'# end;
regression'# ' language 'plpgsql';
CREATE FUNCTION
regression=# select splite_delete_configured_selection(1,2,3,4);
splite_delete_configured_selection
------------------------------------

(1 row)

regards, tom lane

#3Avi Schwartz
avi@CFFtechnologies.com
In reply to: Tom Lane (#2)
Re: Unknown kind of return type specified for function

Tom, your example showed me what my problem was.

I was doing a 'select * from function(1,2,3)' instead for just 'select
function(1,2,3)'

Some of the error messages returned are so cryptic it is scary...

Avi

On Sunday, Jun 15, 2003, at 00:05 America/Chicago, Tom Lane wrote:

Show quoted text

Avi Schwartz <avi@CFFtechnologies.com> writes:

How do I declare the fact that the function will return nothing?

"returns void" works fine for me.

regression=# create or replace function
splite_delete_configured_selection(int,
regression(# int, int, int)
regression-# returns void
regression-# as '
regression'# begin
regression'# return;
regression'# end;
regression'# ' language 'plpgsql';
CREATE FUNCTION
regression=# select splite_delete_configured_selection(1,2,3,4);
splite_delete_configured_selection
------------------------------------

(1 row)

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Avi Schwartz (#3)
Re: Unknown kind of return type specified for function

Avi Schwartz <avi@CFFtechnologies.com> writes:

Tom, your example showed me what my problem was.
I was doing a 'select * from function(1,2,3)' instead for just 'select
function(1,2,3)'

Some of the error messages returned are so cryptic it is scary...

I agree, this one's pretty unhelpful, although in the original author's
defense I don't think he realized that users would actually get to see
this case.

As of a few seconds ago, CVS tip will say

ERROR: function foo() in FROM has unsupported return type

which hopefully is a little more useful.

regards, tom lane