X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6F6A99DCC44 for ; Thu, 9 Mar 2006 09:49:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68841-01 for ; Thu, 9 Mar 2006 09:49:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail49.e.nsc.no (mail49.e.nsc.no [193.213.115.49]) by postgresql.org (Postfix) with ESMTP id 751619DCC3A for ; Thu, 9 Mar 2006 09:49:33 -0400 (AST) Received: from [192.168.0.57] (062016183238.customer.alfanett.no [62.16.183.238]) (authenticated bits=0) by mail49.nsc.no (8.13.5/8.13.5) with ESMTP id k29DnZdY014521 for ; Thu, 9 Mar 2006 14:49:36 +0100 (CET) From: "Leif B. Kristensen" To: pgsql-sql@postgresql.org Subject: Re: Date: Thu, 9 Mar 2006 14:49:34 +0100 User-Agent: KMail/1.8.3 References: In-Reply-To: X-Face: %iea8o"[SI'kMDS.`hz7lU=?\^lC9J-]CVjo; f{4-C:$?uVUEjyN~uYFn%*aH_c3d09U>=?utf-8?q?x=0A=09TXtaoj=7EMV=2E8PgG7hik9=3BcCT2N6+u?=@Y{wH\p3*_f~FH9k,Wi74e[_l%.7b^'zJ)8S'^G<(=?utf-8?q?=3D=0A=09zw8=5CPMC3=27=7BKl9=2EzL*ks!b6wA?=,c~'F`k&Vq|ELDGa|4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.1 required=5 tests=[AWL=0.100] X-Spam-Score: 0.1 X-Spam-Level: X-Archive-Number: 200603/134 X-Sequence-Number: 24480 On Thursday 09 March 2006 14:35, Klay Martens wrote: >

Hi all.

> > >

I am new to postgres, so I am > still learning the basics.

> > >

In Sequel Server, one can set > up a function to return a table eg:

> > >

 

> > >

CREATE FUNCTION > [dbo].[AuthCodes] (@CLIENTID INT)  >

> > >

RETURNS @AuthCodes > TABLE

> > >

(

> > >

style=3D"">           >  [ID] INT,

> > >

style=3D"">           >  AUTHCODE VARCHAR(100),

> > >

style=3D"">           >  ISSUEDATE DATETIME,

> > >

style=3D"">           >  ISSUEDBY VARCHAR(100),

> > >

style=3D"">           >  RECIPIENT VARCHAR(100),

> > >

style=3D"">           >  EMAILID VARCHAR(100)    >

> > >

)

> > >

 

> > >

and then use select into or > insert to populate the table.

> > >

I am really battling to figure > out how to do the same in a postgres function.

> > >

It seems like one would have > to create a user defined type (myType for eg), and then set the > return type of the function to be a set of myType, but I can=92t seem > to make it work. I am guessing that I am on the wrong track=85does > anyone have any suggestions, or examples I could > follow?

Please don't post HTML messages to mail lists. =2D-=20 Leif Biberg Kristensen | Registered Linux User #338009 http://solumslekt.org/ | Cruising with Gentoo/KDE