Unix Technical Forum

Re: procedure properties problem

This is a discussion on Re: procedure properties problem within the pgsql Interfaces Pgadmin Support forums, part of the PostgreSQL category; --> > -----Original Message----- > From: pgadmin-support-owner@postgresql.org > [mailto gadmin-support-owner@postgresql.org] On Behalf Of > Rikard Pavelic > Sent: 16 January ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces Pgadmin Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 08:19 PM
Dave Page
 
Posts: n/a
Default Re: procedure properties problem



> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailtogadmin-support-owner@postgresql.org] On Behalf Of
> Rikard Pavelic
> Sent: 16 January 2006 15:02
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] procedure properties problem
>
> Hi!
> I don't know if this is missing feature or bug, but just to
> report this.
>
> If I create functions like
> create or replace function example(out data varchar) returns
> setof record as
> $$
> select data from table
> $$ language sql;
>
> pgAdmin displays it without 'returns setof record'.


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/i...efunction.html)

If you remove the OUT/INOUT parameters, pgAdmin will display the
definition with the RETURNS SETOF clause.

Regards, Dave.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 08:19 PM
Rikard Pavelic
 
Posts: n/a
Default Re: procedure properties problem

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/i...efunction.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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:50 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com