Re: PL/PGSQL Record type question

From: imad <immaad(at)gmail(dot)com>
To: Gábriel Ákos <akos(dot)gabriel(at)i-logic(dot)hu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: PL/PGSQL Record type question
Date: 2007-05-11 16:40:34
Message-ID: 1f30b80c0705110940w4dbba2b1j705a44f514843e75@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

create a function with return type as a RECORD.

CREATE FUNCTION xyz() RETURNS record AS
$$
declare
abc RECORD;
begin
abc := (1, 2);
return abc;
end;
$$
language plpgsql;

And execute the function in this fashion:

select a, b from xyz() as (a int, b int);

Do you like that ... :-)

--Imad
www.EnterpriseDB.com

On 5/11/07, Gábriel Ákos <akos(dot)gabriel(at)i-logic(dot)hu> wrote:
> On Fri, 11 May 2007 19:09:07 +0500
> imad <immaad(at)gmail(dot)com> wrote:
>
> > You might be looking for PostgreSQL RECORD data type.
>
> Thanks. Give me an example please. I saw the documentation already.
>
> >
> > --Imad
> > www.EnterpriseDB.com
> >
> > On 5/11/07, Gábriel Ákos <akos(dot)gabriel(at)i-logic(dot)hu> wrote:
> > > Hi,
> > >
> > > How should I define a record type (there is no table with this
> > > record type) programmatically in pl/pgsql?
> > > I'd like to return a record with 3 string elements, 2 integers and 1
> > > date.
>
>
>
> --
> Üdvözlettel,
> Gábriel Ákos
> -=E-Mail :akos(dot)gabriel(at)i-logic(dot)hu|Web: http://www.i-logic.hu =-
> -=Tel/fax:+3612367353 |Mobil:+36209278894 =-
>
> ---------------------------(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
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Robins 2007-05-11 17:39:08 Re: PL/PGSQL Record type question
Previous Message Rodrigo De León 2007-05-11 16:36:25 Re: Convert serial column to regular integer