Re: Why select * from function doesn't work when function

From: "Francisco Figueiredo Jr(dot)" <fxjrlists(at)yahoo(dot)com(dot)br>
To: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Why select * from function doesn't work when function
Date: 2003-07-24 13:51:00
Message-ID: 3F1FE444.6050107@yahoo.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nigel J. Andrews wrote:

> On Tue, 22 Jul 2003, Francisco Figueiredo Jr. wrote:
>
>
>>>How's this for an alternative if you really don't want any rows returned:
>>>
>>>create function fincF ( ) returns setof integer as '
>>> begin
>>> delete from blah;
>>> return;
>>> end;
>>>' language 'plpgsql';
>>>
>>>
>>
>>This works, but what I really want is not to return any rows. I mean,
>>the problem is not return null, but the error I get if I select * from
>>voidfunction.
>>
>>I just wanted void functions behave like others when called as select *
>>from voidfunction So I dont have to do select voidfunction. :)
>
>
> But that last does exactly that. Doesn't even return a null. Give it a quick
> go, skip the delete statement obviously, and see. You'll get something like:
>
> ?
> -------
>
> (0 rows)
>

Uhmmm, I think I didn't make myself clear. What I mean by void function
wasn't a function which just doesn't return anything. What I meant is a
function created like this:

create function voidfunction returns *void* as [...]

The problem to me is the void in the returns ;)

If you create a function with the returns void above you'll see that if
you do select * from voidfunction it gives you the error I said. But it
works with select voidfunction.

I just wanted it to work with select * from voidfunction too. :)

Thanks Nigel.

--
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-07-24 14:00:05 Re:
Previous Message Tom Lane 2003-07-24 13:36:23 Re: this is in plain text (row level locks)