Re: procedure properties problem

From: Rikard Pavelic <rikard(dot)pavelic(at)zg(dot)htnet(dot)hr>
To: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
Cc: pgadmin-support(at)postgresql(dot)org
Subject: Re: procedure properties problem
Date: 2006-01-17 10:40:08
Message-ID: 43CCC988.2080609@zg.htnet.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Dave Page wrote:
> The function written above will never work as you have a mismatch of
> parameter and return types, but in answer to your query, the PostgreSQL
> docs say:
>
> "When there are OUT or INOUT parameters, the RETURNS clause may be
> omitted."
>
> (http://www.postgresql.org/docs/8.1/interactive/sql-createfunction.html)
>
> If you remove the OUT/INOUT parameters, pgAdmin will display the
> definition with the RETURNS SETOF clause.
>
> Regards, Dave.
>
>

Well, look at this example then

create table tabla
(
id integer primary key,
data varchar
);

create or replace function example(out data varchar) --returns setof varchar
as $$
select data from tabla
$$
language sql;

insert into tabla values(1,'first example');
insert into tabla values(2,'second example');

select * from example();

If I omit the 'returns setof varchar' I will get only one result from select
If I add 'returns setof varchar' I will get two results.

Best regards,
Rikard

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Dave Page 2006-01-17 12:55:08 Re: procedure properties problem
Previous Message Dave Page 2006-01-17 10:35:48 Re: pgagent jobs never start