From: | "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: |
Date: | 2006-03-09 13:49:34 |
Message-ID: | 200603091449.35028.leif@solumslekt.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thursday 09 March 2006 14:35, Klay Martens wrote:
><p class="MsoNormal"><span lang="EN-ZA">Hi all.<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">I am new to postgres, so I am
> still learning the basics.<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">In Sequel Server, one can set
> up a function to return a table eg:<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><o:p> </o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">CREATE FUNCTION
> [dbo].[AuthCodes] (@CLIENTID INT)<span style="">
> </span><o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">RETURNS @AuthCodes
> TABLE<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">(<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>[ID] INT,<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>AUTHCODE VARCHAR(100),<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>ISSUEDATE DATETIME,<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>ISSUEDBY VARCHAR(100),<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>RECIPIENT VARCHAR(100),<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>EMAILID VARCHAR(100)<span style="">
> </span><o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">)<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><o:p> </o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">and then use select into or
> insert to populate the table.<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">I am really battling to figure
> out how to do the same in a postgres function.<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">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’t seem
> to make it work. I am guessing that I am on the wrong track…does
> anyone have any suggestions, or examples I could
> follow?<o:p></o:p></span></p>
Please don't post HTML messages to mail lists.
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2006-03-09 13:53:12 | Re: |
Previous Message | Klay Martens | 2006-03-09 13:35:45 |