Re: functions problems - Mailing list pgsql-sql

From Randall Lucas
Subject Re: functions problems
Date
Msg-id A3047B78-743F-11D7-9BCD-000A957653D6@tercent.net
Whole thread Raw
In response to functions problems  ("Mario Alberto Soto Cordones" <mario_soto@compuall.cl>)
List 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
>



pgsql-sql by date:

Previous
From: "Mario Alberto Soto Cordones"
Date:
Subject: functions problems
Next
From: "Mario Alberto Soto Cordones"
Date:
Subject: PROBLEM WITH FUNCTIONS