Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 6D91D9FBE1B for ; Fri, 11 May 2007 13:40:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 36845-06 for ; Fri, 11 May 2007 13:40:39 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.240]) by postgresql.org (Postfix) with ESMTP id 4E3949FBF11 for ; Fri, 11 May 2007 13:40:39 -0300 (ADT) Received: by an-out-0708.google.com with SMTP id d17so249494and for ; Fri, 11 May 2007 09:40:38 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UO7OTmnioEp1OjPOIuiaMbXmHIjoZhF/Pm/0Ul6q5RoOzAzYcN64sHa9aOysyQX5tnM28oywgCchS9MYGvhZt7A2FkC+wYXgX6FkJi5/jDFm92nt/w+i1G8a6R/SKj71p5XLQ7jGBxtCSRQLtwItsAXSa7hxyHGK1E230i4+ZKg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CGRnS2rKSjn91lKDNq7eLEdo47dBeMiBUrux2wtl9zgQxi62O5kiWkzAkEXAFeUwsXvqReIZ6YsdRJwR/0NLv/JKi9FsZYFieqPnBKp9lQ+Gcq2PmPdXl0cRQ2fzUitWGiCQ76odzjtBMM9bGbvnUXMOr26w8+0WiqG+hGxwwUw= Received: by 10.101.68.18 with SMTP id v18mr2331459ank.1178901634508; Fri, 11 May 2007 09:40:34 -0700 (PDT) Received: by 10.100.92.4 with HTTP; Fri, 11 May 2007 09:40:34 -0700 (PDT) Message-ID: <1f30b80c0705110940w4dbba2b1j705a44f514843e75@mail.gmail.com> Date: Fri, 11 May 2007 21:40:34 +0500 From: imad To: "=?ISO-8859-1?Q?G=E1briel_=C1kos?=" Subject: Re: PL/PGSQL Record type question Cc: pgsql-sql@postgresql.org In-Reply-To: <20070511164242.7ed1f046@gabriel-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20070511160037.1c09160e@gabriel-laptop> <1f30b80c0705110709u73519990gd6623c6a4c81ee55@mail.gmail.com> <20070511164242.7ed1f046@gabriel-laptop> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/88 X-Sequence-Number: 28368 create a function with return type as a RECORD. CREATE FUNCTION xyz() RETURNS record AS $$ declare abc RECORD; begin abc :=3D (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=E1briel =C1kos wrote: > On Fri, 11 May 2007 19:09:07 +0500 > imad 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=E1briel =C1kos 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. > > > > -- > =DCdv=F6zlettel, > G=E1briel =C1kos > -=3DE-Mail :akos.gabriel@i-logic.hu|Web: http://www.i-logic.hu =3D- > -=3DTel/fax:+3612367353 |Mobil:+36209278894 =3D- > > ---------------------------(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 >