From: imad <immaad@gmail.com>
To: Gábriel Ákos <akos.gabriel@i-logic.hu>
Cc: pgsql-sql@postgresql.org
Subject: Re: PL/PGSQL Record type question
Date: Fri, 11 May 2007 21:40:34 +0500
Message-ID: <1f30b80c0705110940w4dbba2b1j705a44f514843e75@mail.gmail.com> (raw)
In-Reply-To: <20070511164242.7ed1f046@gabriel-laptop>
References: <20070511160037.1c09160e@gabriel-laptop>
<1f30b80c0705110709u73519990gd6623c6a4c81ee55@mail.gmail.com>
<20070511164242.7ed1f046@gabriel-laptop>
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.gabriel@i-logic.hu> wrote:
> On Fri, 11 May 2007 19:09:07 +0500
> imad <immaad@gmail.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.gabriel@i-logic.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.gabriel@i-logic.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
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: immaad@gmail.com, akos.gabriel@i-logic.hu
Subject: Re: PL/PGSQL Record type question
In-Reply-To: <1f30b80c0705110940w4dbba2b1j705a44f514843e75@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox