Re: functions problems

From: Randall Lucas <rlucas(at)tercent(dot)net>
To: "Mario Alberto Soto Cordones" <mario_soto(at)compuall(dot)cl>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: functions problems
Date: 2003-04-21 21:24:29
Message-ID: A3047B78-743F-11D7-9BCD-000A957653D6@tercent.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Mario,

Either have it return a "record" type and use an explicit column
definition list, or else declare a table with the columns as you like
and return a type of a row from that table.

The first one is easy:

create or replace function test__show_record_return(int) returns record
as '
select $1 +1, $1 +2;
' language sql;

select * from test__show_record_return(5) as (plusone int, plustwo int);

Best,

Randall

On Monday, April 21, 2003, at 04:48 PM, Mario Alberto Soto Cordones
wrote:

> Hi.
>
> i have a functions what return one column and work good but when
> create a
> new function to return 2 column´s it´s say error...
>
> any idea
>
> thank
> Mario
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mario Alberto Soto Cordones 2003-04-21 21:38:05 PROBLEM WITH FUNCTIONS
Previous Message Mario Alberto Soto Cordones 2003-04-21 20:48:59 functions problems